Skip to content

[menu] Toggle submenus on repeated trigger activation - #5824

Merged
jjenzz merged 5 commits into
mui:masterfrom
jjenzz:fix-menu-android-a11y
Sep 30, 2026
Merged

jjenzz merged 5 commits into
mui:masterfrom
jjenzz:fix-menu-android-a11y

Conversation

@jjenzz

@jjenzz jjenzz commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

TalkBack users can open a submenu but cannot close it by activating its trigger again with the default openOnHover behavior. TalkBack virtual-cursor navigation does not fire DOM focus events, so moving outside the submenu does not dismiss it; moving the cursor forward again re-enters it. Keep trigger toggling enabled so users can close the submenu and continue to the next item in the parent menu.

Normal keyboard navigation already closes the submenu when returning to its trigger, so activating that trigger still opens it again. Mouse presses retain the existing hover behavior. The toggle applies to supported trigger activations generally, including touch; TalkBack is the motivating case because its virtual cursor leaves DOM focus unchanged.

Extends the TalkBack activation test to cover open → close → reopen with the full virtual pointerdown/mousedown/click sequence, without manually focusing the trigger, and verifies the parent menu stays open and clarifies the existing test for ignoring the trailing click of a TalkBack press.

Validation: submenu tests passed in jsdom (30 passed) and Chromium (33 passed); TypeScript, focused ESLint, and Prettier checks passed.

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 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@5824
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5824
    

commit: 18c3645

@jjenzz jjenzz added component: menu Changes related to the menu component. type: bug It doesn't behave as expected. accessibility a11y labels Sep 29, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-1B(0.00%) ▼-5B(0.00%)

Details of bundle changes

Performance

Total duration: 1,249.34 ms 🔺+334.26 ms(+36.5%) | Renders: 76 (+0) | Paint: 2,098.42 ms 🔺+556.00 ms(+36.0%)

Test Duration Renders
Tabs mount (200 instances) 255.87 ms 🔺+59.17 ms(+30.1%) 3 (+0)
Slider mount (300 instances) 147.68 ms 🔺+44.33 ms(+42.9%) 2 (+0)
Select open (500 options) 86.42 ms 🔺+43.23 ms(+100.1%) 14 (+0)
Checkbox mount (500 instances) 106.35 ms 🔺+41.39 ms(+63.7%) 1 (+0)
Scroll Area mount (300 instances) 91.91 ms 🔺+26.96 ms(+41.5%) 3 (+0)

…and 8 more (+2 within noise) — details

Metric alarms

Test Metric Change
Tabs mount (200 instances) bench:paint 🔺 +81.79 ms
Slider mount (300 instances) bench:paint 🔺 +75.79 ms
Select open (500 options) bench:paint 🔺 +85.19 ms
Select open (500 options) bench:paint#select-open 🔺 +85.19 ms
Checkbox mount (500 instances) bench:paint 🔺 +68.48 ms

…and 12 more metric alarms — details


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

@jjenzz
jjenzz marked this pull request as ready for review September 29, 2026 13:45
@netlify

netlify Bot commented Sep 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit eb5cb80
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6abbbfdb12bdba00082a1e2b
😎 Deploy Preview https://deploy-preview-5824--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.

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 18c3645
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6abbe90e915409000854ced4
😎 Deploy Preview https://deploy-preview-5824--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.

@jjenzz

This comment was marked as resolved.

@github-actions

This comment was marked as outdated.

@jjenzz

jjenzz commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@claude review

@github-actions

This comment was marked as resolved.

@jjenzz

jjenzz commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

Addressed the review feedback in 1464e4b:

  1. Hover-to-keyboard activation: Changed stickIfOpen to openOnHover, so the first activation after hover-opening preserves the submenu. Added Chromium regression cases for Enter and Space; both failed before the fix and pass afterward. Existing repeated TalkBack activation coverage still passes.
  2. Coverage: Added one focused Chromium case for a second ordinary touch tap closing the submenu while its parent stays open. The keyboard cases above cover the keyboard outcome without duplicating those tests. Restored the openOnHover={false} qualifier in the existing TalkBack trailing-click test name.
  3. Explicit default: Kept toggle: true deliberately. Together with its comment, it makes clear that toggling is required; omitting the option would obscure that requirement.
  4. Comment: Clarified that toggling applies to touch and keyboard activation, mouse presses are ignored in hover mode, and the first activation after hover-opening keeps the submenu open.

Validation: submenu trigger suites passed in Chromium (36 passed, 1 skipped) and jsdom (30 passed, 7 skipped). TypeScript, ESLint, Stylelint, Prettier, and diff checks passed. Actual Android TalkBack was not tested.


🤖 Response generated with Codex

@jjenzz
jjenzz merged commit 04e732e into mui:master Sep 30, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y 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