Skip to content

Fix dropdown menu accessibility issues#11232

Merged
riknoll merged 1 commit intomicrosoft:masterfrom
microbit-robert:focus-menu-item
Apr 1, 2026
Merged

Fix dropdown menu accessibility issues#11232
riknoll merged 1 commit intomicrosoft:masterfrom
microbit-robert:focus-menu-item

Conversation

@microbit-robert
Copy link
Copy Markdown
Contributor

This PR addresses a few accessibility issues with the react-common MenuDropdown component.

  • Fixes the accessibility tree by removing wrapping li and ul with roles of "none" and "group". This was causing keyboard navigation with NVDA to get stuck in the menu and VoiceOver to read every menuitem as 1 of 1. Accompanied by minor CSS change to avoid the appearance of a horizontal scroll bar
  • tags are now wrapped in an
  • and both are given appropriate roles
  • The first menuitem is focused when opened via keyboard (mouse behaviour is not affected)
  • Adds new onClickEvent prop to Button which takes the MouseEvent - required to determine whether the menu was opened by mouse of keyboard. I have chosen not to change the existing onClick event to avoid a breaking change across the targets.

Fixes accessibility tree by removing wrapping li and ul
<a> tags are now wrapped in an <li> and given the appropriate role
Focus the first menuitem when opened via keyboard
@riknoll riknoll enabled auto-merge (squash) April 1, 2026 21:51
@riknoll riknoll merged commit 89561b0 into microsoft:master Apr 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants