Repository navigation
Conversation
commit: |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I wonder if these components should render |
If we did this it could render <span role="checkbox">
<input aria-hidden="true" />
</span>Which would also solve: #3143 And the only breaking change would be button->span; however when explicitly labelled and the label doesn't wrap |
And since this is natively supported I think we can't explicitly forbid it whether |
Absolutely! That would address the root issue.
Totally agree!
I like that. A 1:1 output for each component is a more predictable API and gives implementers better control. My intention with this PR was to avoid invalid HTML based on the current implementation, but updating the implementation itself would definitely be the ideal fix. Would you prefer I close this and open an issue outlining the problem? |
I missed that. I don’t think we should settle for losing either implicit or explicit label behavior. Hmm… could we forward the user-defined |
|
Closing in favor of #3205. |
This still works after the change, there's a test here: base-ui/packages/react/src/radio-group/RadioGroup.test.tsx Lines 481 to 511 in 82b925e Your markup looks more or less the same as the example in https://base-ui.com/react/handbook/forms Maybe you're using |

Description
The current examples and guidelines show wrapping components in a
<label>, which is invalid for components that render both a<button>and an<input>(as Checkbox, Radio, and Switch do).Note
The HTML spec for
labeldefines its content model as:That's why the example below fails the W3C Markup Validator:
This PR includes:
<label>.Formintegrations page to remove references to wrapper labels.Checkbox,Radio, andFormto use independent labels.Radio+Form.Caution
These changes make the bug described in #2691 more obvious, since labels associated with
<Checkbox parent />don’t work. The good news is that PR #2896 appears to address that issue.