Skip to content
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

fix(toggle): ensure onToggle still work with props['aria-labelledby'] #13057

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

janhassel
Copy link
Member

Closes #13004

Changelog

New

  • If props['aria-labelledby'] is passed the wrapper element listens for a click event to trigger handleClick as the labeling element is no longer a <label> but a <div> and the <button> is visually hidden.

Changed

  • Clarified the relationship between props.hideLabel and props.labelText in the prop description of props.hideLabel

Testing / Reviewing

  • In the storybook, add a dummy props.onClick and props.onToggle function and verify that they are triggered both by clicking on the toggle and by using the keyboard when props['aria-labelledby'] is passed.
    • Verify that these functions are only called once per click/keyboard interaction.
    • Verify that these functions are also called when props['aria-labelledby'] is not passed.

@janhassel janhassel requested a review from a team as a code owner January 31, 2023 14:05
@netlify
Copy link

netlify bot commented Jan 31, 2023

Deploy Preview for carbon-components-react ready!

Name Link
🔨 Latest commit ed29d73
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/63e258a231eac10008e3f309
😎 Deploy Preview https://deploy-preview-13057--carbon-components-react.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 site settings.

@netlify
Copy link

netlify bot commented Jan 31, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ed29d73
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/63e258a2fa51630008613277
😎 Deploy Preview https://deploy-preview-13057--carbon-elements.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 site settings.

Copy link
Collaborator

@francinelucca francinelucca left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Toggle labelA and labelB are still being ignored when hideLabel is tur
3 participants