Accessibility markup problems in Carbon react overflow menu
See original GitHub issueIn the Carbon react overflow menu:
- the
div
containing the overflow icon needs to haverole="button"
, notrole="menu"
- the button needs a nice default label in case one is not provided, say
aria-label="Menu"
- the
ul
withrole="menu"
needs to have the samearia-label
as the button - there’s a
div
withrole="menuitem"
in the DOM for no apparent reason (see screen snap, below. This may be the cause of https://github.com/IBM/carbon-components-react/issues/1237) - the
div
withrole="button"
(see 1) and theul
withrole="menu"
need to be siblings, i.e. theul
should immediately follow the button in the DOM, so that screen reader users can use their virtual cursor to read through the menu items without getting totally lost.
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (17 by maintainers)
Top Results From Across the Web
Accessibility markup problem in Carbon overflow menu example ...
In the example Carbon vanilla overflow menu: the div with role="button" and the ul with role="menu" need to be siblings (to remove a...
Read more >Accessibility - Overflow menu - Carbon Design System
Each overflow menu is in the tab order and is activated by Space or Enter . When the menu is open, the first...
Read more >What's new - Carbon Design System
This changelog reflects the most recent changes to the design system, from bug fixes to feature enhancements.
Read more >Labeling Controls | Web Accessibility Initiative (WAI) - W3C
Provide labels to identify all form controls, including text fields, checkboxes, radio buttons, and drop-down menus. In most cases, this is done by...
Read more >Building a Data Table Component in React — Development
Must Be Accessible. Finally, to accommodate users with screen readers a data table needs to have proper semantic markup and attributes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Apologies for my suggestion to use “Menu” as a default
aria-label
when a label is not provided. Windows screen readers say “[label] menu button” (NVDA) or “[label] button menu” (JAWS) when focus goes to a button witharia-haspopup="true"
, and so it turns out that “Menu” is redundant (i.e. NVDA says “Menu menu button” and JAWS says “Menu button menu”). A better default string might be “Overflow” or “More…”.Regarding the label for the dropdown ul, it should really use
aria-labelledby
if possible, which can be set to the id for the button, so that the menu always picks up the same label as the button. That would also work if the button had visible text instead of an icon. See the APG menu button example for an example of usingaria-labelledby
on the dropdown menu element.Regarding the problem of having the menu show when the button is in a table and sibling markup is used, this example seems to have solved that problem.
BTW from https://www.w3.org/TR/wai-aria-1.1/#aria-owns: