st.expander scroll bug

When I open the expander, it expands all the way down and then scrolls back up to the top—a sort of scrolling bug. Does anyone know how I can fix it? This occurs sometimes

if used_sources:
for src in used_sources:
with st.expander(f"{src[‘link’]} ({src[‘score’]:.2f})"):
display_clean_context(src[“context”])
st.json(src[“source_metadata”])
else:
st.info(“No source was considered to be used to answer this model.”)

st.markdown("**Relevant Sources (with score)**")
if relevant_sources:
    for src in relevant_sources:
        with st.expander(f"{src['link']} **({src['score']:.2f})**"):
            display_clean_context(src["context"])
            st.json(src["source_metadata"])
else:
    st.info("No relevante source was considered to be used to answer this model.")

Hi @carlos24, can you please format your post so that it’s all in a code-block?

Also, can you try simplifying the code so that it’s reproducible for someone else? Can you include some dummy versions of data like used_sources and functions like display_clean_context, or simplify the example code so it doesn’t use those?