st.expander title rendering issue

Issue Description:

Text overlap/rendering issue in st.expander() where widget key values appear to be rendered on top of the expander title text, causing "key_arrow_down” and “key_arrow_right” to overlap with the actual title text.

:package: Environment Information:

• Streamlit Version: 1.47.0

• Python Version: 3.11 (Snowflake Streamlit environment)

• Platform: Snowflake Streamlit in Snowsight

• OS: Linux (Snowflake managed environment)

:floppy_disk: Minimal Reproducible Code:

import streamlit as st

\# This expander shows text overlap issue where auto-generated 

\# widget keys appear on top of the title text

with st.form("test_form"):

    st.subheader("🔧 Deployment Components")

    st.markdown("\*Select which components to deploy\*")

    comp_col1, comp_col2 = st.columns(2)

    with comp_col1:

        deploy_standard_objects = st.checkbox(

            "Standard Objects",

            value=True,

            help="Deploy standard roles, warehouses, and databases"

        )

        deploy_audit_config = st.checkbox(

            "Audit Configuration",

            value=True,

            help="Set up event tables and monitoring infrastructure"

        )

    with comp_col2:

        deploy_security_policies = st.checkbox(

            "Security Policies",

            value=True,

            help="Deploy network policies and authentication settings"

        )

        deploy_scim_integration = st.checkbox(

            "SCIM Integration",

            value=False,

            help="Enable automated user provisioning"

        )

    \# THIS EXPANDER SHOWS THE TEXT OVERLAP ISSUE

    with st.expander("ℹ️ \*\*What gets deployed?\*\*", expanded=False):

        st.markdown("""

        \*\*Standard Objects:\*\*

        - Core roles (SYSADMIN, ACCOUNTADMIN, etc.)

        - Compute warehouses (DEPLOYMENT_WH, ANALYTICS_WH)

        - Standard databases and schemas

        

        \*\*Audit Configuration:\*\*

        - Event tables for access and query logging

        - Audit streams for real-time monitoring

        - Compliance reporting views

        """)

    \# Form submit button

    submitted = st.form_submit_button("Generate Configuration", type="primary")

\# Minimal test case - plain text only

with st.expander("What gets deployed?", expanded=False):

    st.markdown("Test content")

:bug: Observed Behavior:

• Auto-generated widget key text (like "key_arrow_down” and “key_arrow_right”) appears overlaid/overlapping with the expander title

• The expander title shows both the intended text “What gets deployed?” AND the key value simultaneously

• Text rendering appears corrupted with multiple strings displayed in the same location

:white_check_mark: Expected Behavior:

• Only the expander title “:information_source: What gets deployed?” should be visible

• No auto-generated key values should be rendered in the UI

• Clean, non-overlapping text display

:magnifying_glass_tilted_left: Additional Context:

• Issue occurs specifically within st.form() context

• Multiple widgets (checkboxes, columns) are present before the expander

• Issue persists regardless of emoji usage or markdown formatting in title

• Attempted workaround with explicit key parameter fails because st.expander() doesn’t support key parameter in Streamlit 1.47.0

:camera_with_flash: Visual Evidence:

According to user testing with CoCo analysis, the rendered output shows:

• "key_arrow_down” and “key_arrow_right” text overlapping with “What gets deployed?”

• Both strings visible simultaneously in the expander header area

• Suggests internal widget key generation is being incorrectly rendered to UI

Screenshot:

Hey there, thanks for sharing such a detailed report and welcome to the community! :bug::sparkles: The issue you’re seeing—where “key_arrow_down” and “key_arrow_right” overlap with your expander title—is a known rendering bug in certain Streamlit versions, especially 1.47.0, and is often triggered by a combination of forms, columns, and expanders. This is not expected behavior: only the expander title should be visible, and widget keys should never appear in the UI.

My understanding is that this bug is related to recent changes in the expander’s frontend design and key handling. It’s been discussed in the community and tracked in Streamlit’s GitHub issues, with similar symptoms reported after the expander redesign in 1.47.0+ (see this discussion). The root cause seems to be a UI regression where internal key values are mistakenly rendered as visible text, especially inside forms or when using certain emoji/Markdown in titles. Upgrading to the latest Streamlit version (1.55.0+) should resolve this, as several expander rendering bugs have been fixed in recent releases (see changelog and PRs). If you’re running in Snowflake’s managed environment, you may need to request an environment update or workaround with minimal Markdown in expander titles.

If you need a temporary workaround and can inject custom CSS, you might be able to hide the unwanted key text by targeting its class (see this forum tip). But the most robust fix is to update Streamlit to a version where this bug is resolved. If you’re stuck on 1.47.0 due to platform constraints, consider reporting this to Snowflake support so they can prioritize an upgrade. Community members—if you’ve seen this and have a clever hack, please jump in and share! :butterfly:

Sources:

Thanks for getting back to me. I have forced Snowflake to use v1.52.2 (the latest version Snowflake supports) and the bug is still there. Would you have expected it to have been fixed by this version or do I definitely need to be on 1.55.0+ for it to be fixed?