Skip to content

[select] Fix the root id being ignored inside a Field - #5461

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:atomiks/select-field-root-id
Aug 10, 2026
Merged

[select] Fix the root id being ignored inside a Field#5461
atomiks merged 1 commit into
mui:masterfrom
atomiks:atomiks/select-field-root-id

Conversation

@atomiks

@atomiks atomiks commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

An id on Select.Root is dropped when the Select sits inside a Field.Root. The trigger renders a generated id instead, so #my-id matches nothing and Field.Label points at the generated id. Outside a Field it works.

Select.Trigger registered idProp ?? rootId with the labelable provider, and rootId is the provider's own selected id read back through the Select store. The provider keeps its current selection while that id is still registered, so the generated id kept re-electing itself and the root's id could never take over. The trigger now registers only its own explicit id, which leaves the root as the sole registrant when the trigger has none.

Carved out of #5448, which fixed this through a preferId argument on registerControlId. That argument is not needed for this case.

#5448's notes also describe an exception in the unregister flush for Select.Trigger, because it registered an id adopted from the provider one commit behind. That registration no longer exists, so the exception may no longer be needed.

Still unfixed, and out of scope here: an explicit id on Select.Trigger does not move the label when it changes at runtime, and the equivalent Combobox cases are untouched.

@atomiks atomiks added type: bug It doesn't behave as expected. component: select Changes related to the select component. labels Aug 10, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

commit: a79e436

@code-infra-dashboard

code-infra-dashboard Bot commented Aug 10, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,010.40 ms ▼-391.99 ms(-28.0%) | Renders: 76 (+0) | Paint: 1,586.56 ms ▼-615.44 ms(-27.9%)

Test Duration Renders
Tabs mount (200 instances) 166.05 ms ▼-81.73 ms(-33.0%) 3 (+0)
Select mount (200 instances) 128.10 ms ▼-68.42 ms(-34.8%) 3 (+0)
Menu mount (300 instances) 83.45 ms ▼-59.62 ms(-41.7%) 1 (+0)
Menu open (500 items) 61.20 ms ▼-40.65 ms(-39.9%) 11 (+0)
Popover mount (300 instances) 51.53 ms ▼-34.09 ms(-39.8%) 1 (+0)

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


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

@netlify

netlify Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

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

@atomiks
atomiks force-pushed the atomiks/select-field-root-id branch from 61ad324 to a79e436 Compare August 10, 2026 13:41
@atomiks
atomiks marked this pull request as ready for review August 10, 2026 13:49
@atomiks
atomiks merged commit f7af9e1 into mui:master Aug 10, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: select Changes related to the select component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant