Skip to content

[toggle-group] Remove invalid aria-orientation from role="group" element - #4628

Merged
atomiks merged 3 commits into
mui:masterfrom
sernstberger:fix/toggle-group-aria-orientation
Jun 8, 2026
Merged

atomiks merged 3 commits into
mui:masterfrom
sernstberger:fix/toggle-group-aria-orientation

Conversation

@sernstberger

Copy link
Copy Markdown
Contributor

Summary

ToggleGroup renders role="group" but was also rendering aria-orientation, which is not a valid ARIA attribute for the group role (WAI-ARIA spec). This was flagged by axe's aria-allowed-attr rule.

The aria-orientation attribute was being added by useCompositeRoot (which always includes it in its returned props). This was introduced in #4487 when keyboard navigation was added via CompositeRoot.

Fix

Strip aria-orientation from the DOM output by adding { 'aria-orientation': undefined } to the CompositeRoot props array. This follows the same pattern used by NavigationMenuList and SelectPopup in the codebase.

The orientation prop still reaches CompositeRoot for keyboard navigation — it just won't appear as an ARIA attribute on the rendered element.

Test

Added a test asserting that aria-orientation is not present on the role="group" element.

Closes #4623
Related: #4487

@pkg-pr-new

pkg-pr-new Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

commit: 6d2fed2

@code-infra-dashboard

code-infra-dashboard Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-46B(-0.01%) ▼-15B(-0.01%)

Details of bundle changes

Performance

Total duration: 1,329.47 ms 🔺+274.52 ms(+26.0%) | Renders: 50 (+0) | Paint: 1,997.94 ms 🔺+397.37 ms(+24.8%)

Test Duration Renders
Tabs mount (200 instances) 255.75 ms 🔺+50.68 ms(+24.7%) 4 (+0)
Menu mount (300 instances) 155.56 ms 🔺+33.89 ms(+27.9%) 2 (+0)
Select mount (200 instances) 157.21 ms 🔺+29.16 ms(+22.8%) 3 (+0)
Select open (500 options) 68.68 ms 🔺+25.24 ms(+58.1%) 14 (+0)
Checkbox mount (500 instances) 80.34 ms 🔺+22.66 ms(+39.3%) 1 (+0)

…and 4 more (+3 within noise) — details


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

@netlify

netlify Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

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

@zannager zannager added the component: toggle group Changes related to the toggle group component. label Apr 16, 2026
state={state}
refs={[forwardedRef]}
props={[defaultProps, elementProps]}
props={[defaultProps, { 'aria-orientation': undefined }, elementProps]}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SelectPopup and NavigationMenuList are already overwriting aria-orientation like this, perhaps it should be moved out of Composite and its consumers should be required to set aria-orientation themselves accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: toggle group Changes related to the toggle group component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ToggleGroup] aria-orientation not allowed on role=group element

4 participants