Can pairing aria-controls with aria-expanded stop Narrator from announcing whether a disclosure is expanded or collapsed? What should I test before changing the markup?
Is aria-controls causing Narrator to miss disclosure states?
Answers
It can happen. One reported case found that Narrator sometimes missed the expanded or collapsed state in Edge and Chrome when both attributes were present. Removing aria-controls restored the announcement in those browsers, while Firefox announced the state correctly in that test.
For a simple disclosure, aria-controls is optional. If you don't have a specific need for the relationship, leaving it off is a reasonable workaround. Keep aria-expanded updated as the disclosure opens and closes.
Reply to this answer
I wouldn't strip aria-controls from every component based on this one issue. Other widget patterns may rely on the relationship, and screen reader support varies. Test the specific component with Narrator, NVDA and JAWS in the browsers you support before deciding.
Reply to this answer
For debugging, check the browser's accessibility tree as you toggle the button. If the expanded state updates there but Narrator stays quiet, that helps narrow down where the announcement is getting lost. Compare with and without aria-controls rather than assuming the markup isn't updating.
Reply to this answer
Keep the mobile checks separate from Narrator. TalkBack with Chrome on Android and VoiceOver with Safari on iOS were reported to work in this case, but those results don't tell you what Narrator will do on Windows.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Tervano.7m:
JAWS support for aria-controls has been described as partial, so its presence doesn't guarantee the relationship will be useful to everyone either.