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

feat(RadioButtonGroup): add new legendText prop, refactor stories #7846

Merged
merged 3 commits into from
Feb 25, 2021

Conversation

tw15egan
Copy link
Member

@tw15egan tw15egan commented Feb 18, 2021

Closes #6829

Based on observations by @carmacleod 🥇 , we were utilizing the (hidden) FormGroup component to render the RadioButtonGroup legend text. We were also passing a legend prop to RadioButtonGroup that was doing nothing.

This PR contains a few changes, mainly adding the legendText prop to RadioButtonGroup. That way we reduce the burden of an end-user supplying a fieldset/legend or FormGroup and they can simply supply the legendText prop.

Changelog

New

  • RadioButton-story.js now contains stories that encapsulate RadioButtonGroup and RadioButton, and has the Default and Playground stories
  • Tests relevant to the newly added prop

Changed

  • The inner div inside of RadioButtonGroup is now a fieldset, and if legendText is provided, it will render a legend element to supply the label (link).
  • Moved RadioButtonGroup.mdx to RadioButton.mdx

Removed

  • RadioButtonGroup-story.js
  • Extra margin that was not needed using the correct label class

Testing / Reviewing

Ensure this will properly satisfy a11y concerns with this component, and that there are no breaking changes

@netlify
Copy link

netlify bot commented Feb 19, 2021

Deploy preview for carbon-elements ready!

Built with commit f9df432

https://deploy-preview-7846--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Feb 19, 2021

Deploy preview for carbon-components-react ready!

Built without sensitive environment variables with commit f9df432

https://deploy-preview-7846--carbon-components-react.netlify.app

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Feb 25, 2021

This PR currently has a merge conflict. Please resolve this and then re-add the status: ready to merge 🎉 label.

@kodiakhq kodiakhq bot merged commit a987ca4 into carbon-design-system:master Feb 25, 2021
@dakahn dakahn mentioned this pull request Mar 4, 2021
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.

Missing doc in radiobutton can lead to accessibility problems
4 participants