base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[field] Forward `controlId` from `FieldRoot`

Open mj12albert opened this issue 5 months ago • 4 comments

Fixes https://github.com/mui/base-ui/pull/2154#issuecomment-2999545029

Links the labels to ids sooner to avoid browser errors, currently in Chrome there are blue warnings on the labels of Input, Select and NumberField as well

mj12albert avatar Jun 24 '25 17:06 mj12albert

Open in StackBlitz

npm i https://pkg.pr.new/@base-ui-components/react@2158

commit: ba9b318

pkg-pr-new[bot] avatar Jun 24 '25 17:06 pkg-pr-new[bot]

Bundle size report

Bundle Parsed Size Gzip Size
@base-ui-components/react 🔺+210B(+0.07%) 🔺+114B(+0.12%)

Details of bundle changes

Generated by :no_entry_sign: dangerJS against ba9b3186e20cda1d69444c083e6af9db2617b6be

mui-bot avatar Jun 24 '25 17:06 mui-bot

Deploy Preview for base-ui ready!

Name Link
Latest commit ba9b3186e20cda1d69444c083e6af9db2617b6be
Latest deploy log https://app.netlify.com/projects/base-ui/deploys/685bdeb417cab80008226a6a
Deploy Preview https://deploy-preview-2158--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.

netlify[bot] avatar Jun 24 '25 17:06 netlify[bot]

Initializing controlId from Field breaks the implicitly linked controls like radio/switch/checkbox since the default id is rendered until it's unset on mount and causes the same red warning: output

Deferring the label's htmlFor to a state causes blue warnings for explicitly linked controls (e.g. Input):

Screenshot 2025-06-25 at 8 32 18 PM

mj12albert avatar Jun 25 '25 12:06 mj12albert