question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessibility markup problems in Carbon react overflow menu

See original GitHub issue

In the Carbon react overflow menu:

  1. the div containing the overflow icon needs to have role="button", not role="menu"
  2. the button needs a nice default label in case one is not provided, say aria-label="Menu"
  3. the ul with role="menu" needs to have the same aria-label as the button
  4. there’s a div with role="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)
  5. the div with role="button" (see 1) and the ul with role="menu" need to be siblings, i.e. the ul 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.

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
carmacleodcommented, Jun 17, 2019

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 with aria-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 using aria-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.

1reaction
asudohcommented, Jun 8, 2019

BTW from https://www.w3.org/TR/wai-aria-1.1/#aria-owns:

Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found