Repository navigation
[menubar] Fix menubar a11y tree to satisfy aria-required-children - #5058
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,313.57 ms -21.20 ms(-1.6%) | Renders: 76 (+0) | Paint: 2,062.06 ms -20.47 ms(-1.0%)
10 tests within noise — details Metric alarms
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1297ed190
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <MenuPortalContext.Provider value={keepMounted}> | ||
| <FloatingPortal ref={forwardedRef} {...portalProps} /> | ||
| {/* The hidden `aria-owns` owner must be an allowed child of `menu` and `menubar`. */} | ||
| <FloatingPortal ref={forwardedRef} {...portalProps} portalOwnerRole="group" /> |
There was a problem hiding this comment.
Gate the hidden owner role to menu parents
When Menu.Portal belongs to a plain root Menu.Root (parent.type is undefined), the hidden aria-owns span is rendered next to the trigger rather than as a child of a menu/menubar, so the aria-required-children workaround is not needed there. Passing portalOwnerRole="group" unconditionally makes every open root menu expose an extra accessible group (the updated group-label tests had to scope getByRole('group') to avoid this new owner), which changes regular menu semantics for assistive tech. Please only pass the group role for the contexts that need it, such as submenu and menubar parents.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Seems like Menubars don't work with VoiceOver virtual cursor to begin with (tested master with Safari and Chrome on Mac — it just moves to the browser minimise buttons). This PR doesn't change anything from what I tested. And iOS VoiceOver is also still fine.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4eb9e7453
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c4eb9e7 to
534fe4a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9e69d1b49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This is an alternative to #4027.
It renders the span with
aria-ownswithrole=group. Groups are allowed within menus and an empty group does not mess up the accessibility tree.Lighthouse does not complain anymore.
Fixes #4004