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(a11y): associate group label with radio buttons #1784

Closed
wants to merge 2 commits into from

Conversation

andresdeque
Copy link

  • Replaced the div with a fieldset element to semantically group radio buttons.
  • Added a legend element containing the groupLabel to serve as the group label.
  • Ensured that the groupLabel is properly associated with its group of radio buttons for improved accessibility compliance.
  • Updated the component's props to include groupLabel for specifying the group label.
  • Applied necessary styling to ensure the fieldset and legend elements integrate seamlessly with existing styles.

Closes: #4498

- Replaced the `div` with a `fieldset` element to semantically group radio buttons.
- Added a `legend` element containing the `groupLabel` to serve as the group label.
- Ensured that the `groupLabel` is properly associated with its group of radio buttons for improved accessibility compliance.
- Updated the component's props to include `groupLabel` for specifying the group label.
- Applied necessary styling to ensure the `fieldset` and `legend` elements integrate seamlessly with existing styles.

Closes: #4498
@andresdeque andresdeque requested a review from a team as a code owner January 17, 2025 04:16
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1784.d15792l1n26ww3.amplifyapp.com

Copy link
Member

@scurker scurker left a comment

Choose a reason for hiding this comment

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

What change is this referencing? This is introducing a breaking change with the introduction of a required prop and is not documented as such. Any breaking changes must go through a RFC (request for comments) and have a minimum period of 2 months before we can introduce the change.

The documented pattern for RadioGroup shows the current expected pattern for this component to be used:

<div className="Field__label" id="pizza-label">Do you like pizza?</div>
<RadioGroup
  aria-labelledby="pizza-label"
  defaultValue="tuesday"
  name="pizza"
  radios={[ ...items ]}
/>

…r aria-labelledby

	•	Updated RadioGroup component to display groupLabel within the <legend> element.
	•	If groupLabel is omitted, the component now requires either aria-label or aria-labelledby to ensure the radio group is properly labeled for accessibility.
	•	Updated the MDX documentation to reflect these changes and provide clear usage examples.

Closes: #4498
@andresdeque andresdeque requested a review from a team as a code owner January 17, 2025 17:49
@scurker
Copy link
Member

scurker commented Jan 17, 2025

@andresdeque I hid your comment because it contains proprietary information that shouldn't be made public. Please note, Cauldron is a public repo so we must take care we're not distributing internal information.

As per your comment, this is not a change we can currently make in Cauldron. The change must be made in the product utilizing the existing documentation provided in Cauldron. As such, I'm closing this PR.

@scurker scurker closed this Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants