Repository navigation
[menu] Close submenu when focus returns through its guard - #5793
Conversation
commit: |
Bundle size
PerformanceTotal duration: 908.88 ms -3.38 ms(-0.4%) | Renders: 76 (+0) | Paint: 1,515.45 ms +11.26 ms(+0.7%)
14 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
898e75a to
1a48cb0
Compare
|
@claude review |
This comment was marked as resolved.
This comment was marked as resolved.
Feedback responsesThanks for the review. Here is the outcome for each feedback point:
The MenuRoot and MenuSubmenuTrigger tests pass in jsdom and Chromium. TypeScript, ESLint, Stylelint, and Prettier pass. 🤖 Feedback addressed by Codex |
Summary
The bug: On iPhone VoiceOver, moving back from an open submenu to its trigger leaves the submenu open, so moving forward enters the submenu again instead of reaching the next item in the parent menu. The screen reader user cannot continue past the trigger.
ScreenRecording_09-24-2026.16-00-40_1.mov
Note how I cannot move down to Play Next, it just keeps re-entering the submenu
The fix: Closes the submenu when focus returns to its trigger through the submenu focus guard. This applies to keyboard navigation such as Shift+Tab and is especially needed when a screen reader moves back to the trigger, so navigation can continue to the next parent menu item. The existing
beforeContentFocusGuardRefis now connected for submenus, so the trigger can identify that return by comparing the focus event'srelatedTargetdirectly with its focus guard. Hovering back to the trigger can also move focus there directly from a submenu item; that should leave the submenu open.Tests
masterbefore the fix and passes afterward.pnpm test:jsdom MenuSubmenuTrigger --no-watchpnpm test:chromium MenuSubmenuTrigger --no-watchpnpm test:jsdom MenuRoot --no-watchpnpm test:chromium MenuRoot --no-watchpnpm typescriptpnpm eslintpnpm prettierpnpm stylelint