Plotly legendgrouptitle parameter not working with streamlit

Hi everyone,
I want to group legends in groups and assign titles for them. This is an example using pure plotly:

import plotly.graph_objects as go
import streamlit as st
fig = go.Figure()

fig.add_trace(go.Scatter3d(
    x=[1, 2, 3],
    y=[2, 1, 3],
    z=[0, 0, 0],
    legendgroup="group",  # this can be any string, not just "group"
    legendgrouptitle_text="First Group Title",
    name="first legend group",
    mode="markers",
    marker=dict(color="Crimson", size=10)
))

fig.add_trace(go.Scatter3d(
    x=[1, 2, 3],
    y=[2, 2, 2],
    z=[0, 0, 0],
    legendgroup="group",
    name="first legend group - average",
    mode="lines",
    line=dict(color="Crimson")
))

fig.add_trace(go.Scatter3d(
    x=[1, 2, 3],
    y=[4, 9, 2],
    z=[1, 1, 1],
    legendgroup="group2",
    name="second legend group",
    legendgrouptitle=dict(text="Second Group Title"),
    mode="markers",
    marker=dict(color="MediumPurple", size=10)
))

fig.add_trace(go.Scatter3d(
    x=[1, 2, 3],
    y=[5, 5, 5],
    z=[1, 1, 1],
    legendgroup="group2",
    name="second legend group - average",

    mode="lines",
    line=dict(color="MediumPurple")
))

fig.update_layout(title="Try Clicking on the Legend Items!")
fig.show()

which returns this graph and its legend:

You can see there are group names on top of each legend group. But when I run it with streamlit, by adding the_plot = st.plotly_chart(fig) at the end of the above code, the result is like this:


As you can see the group name is missing. Am I doing anything wrong, or this is an oversight from streamlit side. Thank you!