Subject of the issue
The following issue has been reported by an external accessibility auditor:
The aria-expanded="false" attribute is specified to the "Open course resources.", "Page progress" and "Visual accessibility settings" image buttons. However the mentioned image buttons displays a modal dialog on activating them and there is no expand/collapse functionality is associated with the mentioned image buttons. This might create confusion for screen reader users.
Fails WCAG Success Criteria 4.1.2 https://www.w3.org/WAI/WCAG20/Understanding/name-role-value
Having done some research I'm inclined to agree. Please see my points below but I'm interested in hearing thought from others.
- The use of
aria-expanded assumes the button toggles the collapse as well as the expanding of the dialog. The button only triggers the expanding of the dialog. The dialog is self closing (either shadow or close button).
- The dialog isn't a sibling or child of the button.
- Whilst MDN references the use of
aria-expanded for dialog elements, I think this is in reference to non-modal dialogs (where focus can move outside of the dialog whilst still visible). Modal dialogs trap focus within the popup only and prevent learners from interacting with the rest of the page until the dialog is closed. Therefor the change in aria-expanded state isn't accessible, it will only be read as "collapsed".
- The WCAG dialog (modal) example doesn't include
aria-expanded.
Some of these points were made previously when the initial issue was raised for WCAG fail of Drawer.
Reference: initial issue raise to implement aria-expanded.
Steps to reproduce
- Using screen reader, navigate to the mentioned image buttons.
- Listen that the incorrect state is announced.
Expected behaviour
Whilst I don't think aria-expanded is the appropriate use, I do think it's useful to indicate the buttons do trigger the change in page content.
As an alternative to aria-expanded, I wonder whether adding "Open" to the existing button aria-labels is sufficient? Like we already have for Resources, "Open course resources". However if people are in favour of the current implementation I'm happy to leave as is.