Skip to content

Comments

[checkbox][switch][radio] Add automatic aria-labelledby support#4142

Merged
atomiks merged 2 commits intomui:masterfrom
atomiks:codex/extract-pr-4126-ssr-labeling
Feb 24, 2026
Merged

[checkbox][switch][radio] Add automatic aria-labelledby support#4142
atomiks merged 2 commits intomui:masterfrom
atomiks:codex/extract-pr-4126-ssr-labeling

Conversation

@atomiks
Copy link
Contributor

@atomiks atomiks commented Feb 20, 2026

Adds the changes from #4126 without new APIs.

Checkbox, Switch, and Radio receive aria-labelledby after hydration for non-nativeButton roots and native <label> elements.

<Field.Label> already links post-hydration as well, and adding support for SSR is non-trivial as it can leave dangling aria-labelledby refs that don't point to a label element if the label is not rendered somewhere. It's possible to warn, but might be breaking — left it to a different PR

Fixes #4122

@atomiks atomiks added type: bug It doesn't behave as expected. component: field Changes related to the field component. labels Feb 20, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 20, 2026

commit: 86dd78f

@mui-bot
Copy link

mui-bot commented Feb 20, 2026

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+564B(+0.12%) 🔺+278B(+0.19%)

Details of bundle changes


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

@netlify
Copy link

netlify bot commented Feb 20, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 86dd78f
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/699d57252def370008287cd1
😎 Deploy Preview https://deploy-preview-4142--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@atomiks atomiks force-pushed the codex/extract-pr-4126-ssr-labeling branch 4 times, most recently from 1d20564 to e5af8d4 Compare February 20, 2026 02:51
@atomiks atomiks marked this pull request as ready for review February 20, 2026 02:55
@atomiks atomiks force-pushed the codex/extract-pr-4126-ssr-labeling branch from 966e360 to f818f0e Compare February 24, 2026 04:59
@atomiks atomiks changed the title [field] Add server id linking and automatic aria-labelledby support [checkbox][switch][radio] Add automatic aria-labelledby support Feb 24, 2026
@atomiks atomiks added component: switch Changes related to the switch component. component: checkbox Changes related to the checkbox component. component: radio group Changes related to the radio group component. and removed component: field Changes related to the field component. labels Feb 24, 2026
@atomiks atomiks force-pushed the codex/extract-pr-4126-ssr-labeling branch from bea79e8 to 192073e Compare February 24, 2026 06:28
Copy link
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

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

Looks good ~

@atomiks atomiks force-pushed the codex/extract-pr-4126-ssr-labeling branch from 192073e to a6e5f09 Compare February 24, 2026 07:33
@atomiks atomiks merged commit 35e3216 into mui:master Feb 24, 2026
23 checks passed
@atomiks atomiks deleted the codex/extract-pr-4126-ssr-labeling branch February 24, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: checkbox Changes related to the checkbox component. component: radio group Changes related to the radio group component. component: switch Changes related to the switch component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radio.Root, Checkbox.Root, and Switch.Root do not receive an accessible name from a wrapping <label> element

3 participants