-
Notifications
You must be signed in to change notification settings - Fork 3.4k
nav-bar: Screen readers can't properly interact with a button inside an option inside a listbox. #11485
Description
Bug, enhancement request, or proposal:
Bug
CodePen and steps to reproduce the issue:
CodePen Demo which demonstrates the issue:
Sorry, due to the inaccessibility of CodePen's editors, I cannot actually provide a codePen example for this. What I've done is change the ARIA roles to my proposed roles via the Firefox dev tools to prove that these work better with a screen reader.
Detailed Reproduction Steps:
- Open any example that uses the md-nav-bar and md-nav-item elements.
- Try to interact with them using the NVDA screen reader and current Firefox on Windows.
What is the expected behavior?
NVDA should see the buttons and be able to select each.
What is the current behavior?
NVDA sees the listbox, but nothing in it. Only if I press Enter while the virtual (browse mode) cursor is on the list box, do I get focus to the buttons and can select each. The reason is that a button inside an option inside a listbox is totally non-standard and not expected by any current design pattern.
What is the use-case or motivation for changing an existing behavior?
Better accessibility for blind screen reader users.
Which versions of AngularJS, Material, OS, and browsers are affected?
- AngularJS: Version used by Material.
- AngularJS Material: Current Master.
- OS: Windows 10
- Browsers: Firefox, Chrome.
Is there anything else we should know? Stack Traces, Screenshots, etc.
The design pattern from the WAI-ARIA Authoring Practices no longer exists and thus should be re-thought. The closest pattern is:
- Change the role on the md-nav-bar from "listbox" to "tablist".
- Change the role of the li inside the md-nav-item template from "option" to "presentation".
- Add the role "tab" to the button in the button template for the li element.
- Set aria-selected on the button directly instead of the li element, since that is now presentational.
That way, the widget becomes a tab list with true tabs as children in the accessibility layer, which is a totally valid pattern and supported by screen readers. The one piece that is missing, since it is not part of this compound widget, is the correllation to a tabpanel object.
The alternative would be to use toolbar and buttons that are turned into toggle buttons, or alternatively, radio buttons of which only one can be selected at a time, but since visually these often look like tabs anyway, using the tablist and tab roles is the closest match.