-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(toggle): allow to be labelled by another element #12974
Conversation
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding this in Jan 🎉
Hey there! v11.21.0 was just released that references this issue/PR. |
Closes #12896
Implements the behaviour outlined in #12896 (comment) (option 2).
See "Testing / Review" at the end of this PR for details.
Changelog
New
aria-labelledby
as optional prop forToggle
Changed
props.labelText
validation forToggle
Toggle
Testing / Reviewing
props.hideLabel === true
andprops['aria-labelledby]
IS NOT passed:props.labelText
on the side (instead ofprops.labelA
andprops.labelB
.cds--toggle__label
is a<label>
.cds--toggle__label
has afor
attribute pointing to the<button>
id (props.id
)props.hideLabel === true
andprops['aria-labelledby]
IS passed:.cds--toggle__text
) doesn't exist.cds--toggle__label
is a<div>
props.hideLabel === false
andprops['aria-labelledby]
IS passed:.cds--toggle__label
is a<div>
props.labelText
is rendered on top of the toggleprops.hideLabel === false
andprops['aria-labelledby]
IS passed andprops.labelText
IS NOT passed:.cds--toggle__label
is a<div>
.cds--toggle__label-text
doesn't exist