Skip to content

[menu] Fix VoiceOver announcement when opening a submenu - #5342

Merged
atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/voiceover-submenu-announce-51c0d9
Jul 27, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/voiceover-submenu-announce-51c0d9

Conversation

@atomiks

@atomiks atomiks commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

VoiceOver doesn't announce the first submenu item when a submenu is opened — it announces the trigger again instead, including its freshly changed expanded state. Opening the submenu flips aria-expanded to true while the trigger still holds focus, and VoiceOver announces that state change over the item that focus moves to a moment later.

This PR makes it so the submenu trigger now omits aria-expanded while its submenu is open on Apple platforms. aria-haspopup="menu" and aria-controls are untouched, and aria-expanded="false" is still exposed while closed, so the only thing given up is the expanded state at the moment focus is already inside the submenu. Omitting the state rather than reporting false means nothing incorrect is exposed, which is why this doesn't need to be narrowed to keyboard opens.

Alternative to #5067, which fixes the same bug by also dropping the popup's aria-labelledby and the trigger's aria-controls and deferring initial focus by a frame. Testing each edge in isolation with VoiceOver, aria-labelledby and aria-controls turned out to be irrelevant and aria-expanded alone load-bearing, so the util files, openEvent plumbing, and the useListNavigation deferral aren't needed.

Since focus moves into the submenu when it opens, the only time users can tell if aria-expanded="true" is applied is if they move focus back to the submenu trigger, which is not a common navigation pattern. And even then, it doesn't say it's collapsed incorrectly, it just lacks expanded. This trade-off appears worth it.

Screenshot 2026-07-27 at 10 12 41 am

@atomiks atomiks added component: menu Changes related to the menu component. type: bug It doesn't behave as expected. labels Jul 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5342
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5342
    

commit: 048d5fd

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+155B(+0.03%) 🔺+57B(+0.04%)

Details of bundle changes

Performance

Total duration: 1,239.48 ms +63.62 ms(+5.4%) | Renders: 78 (+0) | Paint: 1,936.61 ms +102.16 ms(+5.6%)

Test Duration Renders
Menu open (500 items) 86.39 ms 🔺+15.86 ms(+22.5%) 12 (+0)
Tooltip mount (300 contained roots) 54.96 ms 🔺+9.89 ms(+21.9%) 1 (+0)

13 tests within noise — details

Metric alarms

Test Metric Change
Menu open (500 items) bench:paint 🔺 +22.99 ms
Menu open (500 items) bench:paint#menu-open 🔺 +22.99 ms

Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 048d5fd
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a66eb8a1e3ff8000868df89
😎 Deploy Preview https://deploy-preview-5342--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks marked this pull request as ready for review July 26, 2026 23:14
@atomiks
atomiks requested a review from Copilot July 27, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@atomiks
atomiks force-pushed the claude/voiceover-submenu-announce-51c0d9 branch from 8b52a5a to 048d5fd Compare July 27, 2026 05:24
@atomiks
atomiks merged commit 022d979 into mui:master Jul 27, 2026
6 checks passed
@atomiks
atomiks deleted the claude/voiceover-submenu-announce-51c0d9 branch July 27, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: menu Changes related to the menu component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants