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(material/radio): required attribute being set on buttons #30434

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

naaajii
Copy link
Contributor

@naaajii naaajii commented Feb 2, 2025

fixes when MatRadioGroup is set to be required it was setting all of its MatRadioButton to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of MatRadioGroup

fixes #30399

@naaajii naaajii requested a review from a team as a code owner February 2, 2025 09:53
@naaajii naaajii requested review from mmalerba and wagnermaciel and removed request for a team February 2, 2025 09:53
Copy link
Contributor

@andrewseguin andrewseguin left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

src/material/radio/radio.html Outdated Show resolved Hide resolved
@andrewseguin andrewseguin self-assigned this Feb 3, 2025
@naaajii naaajii force-pushed the fix/30399 branch 2 times, most recently from 92c7a6b to 99d1dfd Compare February 3, 2025 17:46
@naaajii naaajii requested a review from andrewseguin February 3, 2025 17:53
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton`
to be required as-well which is confusing for assistive technologies, this commit ensures
we only set aria-required on group rather than all buttons unless button is being used
standalone of `MatRadioGroup`

fixes angular#30399
// we never want to set required attribute on input when we have MatRadioGroup as we will set
// aria-required directly on MatRadioGroup if its required as setting on all MatRadioButton for
// it's MatRadioGroup would be confusing for assistive technology.
if (this.radioGroup) return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

made it that if used with group we don't set required attribute on inputs, this might be breaking for people who explicitly set required on radios.

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(MatRadioButton): The required attribute is used on a radio button
2 participants