label_visibility="hidden" since Streamlit 1.11: does the accessible name still reach screen readers after re-runs?
21.5K reputation · 10 Jul 2020, 10:15 UTC
Goal
I'm designing a Streamlit app (1.11 or newer) that uses label_visibility="hidden" on several st.text_input and st.selectbox widgets to reduce visual clutter, while still relying on the label parameter as the accessible name for assistive technology.
Constraints and uncertainty
The documentation states the label is retained for accessibility when hidden, but Streamlit re-runs the full script on every interaction, and I have not found a documented conformance claim (e.g., a WCAG level) covering how the rendered DOM behaves across those re-runs. It is unclear whether the hidden label is consistently exposed as an aria-label or an associated <label> element, and whether dynamic widget updates are announced reliably by screen readers such as NVDA or VoiceOver.
Keyboard focus order after a re-run is also a concern, since hidden labels remove a visible anchor for sighted keyboard users.
Questions
- With
label_visibility="hidden", what does the current Streamlit version actually render for the accessible name, and does it differ betweenhiddenandcollapsed? - After a script re-run triggered by a widget interaction, do screen readers announce the updated widget state, or does focus reset in a way that breaks the workflow?
- Is there any documented or recommended pattern for keeping focus stable for keyboard-only users in current Streamlit releases?