Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(radio): deselect button if value doesn't match up with the group anymore #14734

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

Open
crisbeto wants to merge 1 commit into angular:main
base: main
Choose a base branch
Loading
from crisbeto:radio-selected-button-value-change

Conversation

Copy link
Member

@crisbeto crisbeto commented Jan 5, 2019

Handles the case where a radio button is selected and then its value is changed to something that doesn't match up with the group anymore.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jan 5, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 5, 2019
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM

@devversion devversion added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jan 5, 2019
jelbourn
jelbourn previously approved these changes Jan 8, 2019
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

crisbeto added a commit to crisbeto/material2 that referenced this pull request Jan 11, 2019
Along the same lines as angular#14734. Deselects a selected list option, if its value is changed to something that doesn't match up with the group.
vivian-hu-zz pushed a commit that referenced this pull request Jan 17, 2019
Along the same lines as #14734. Deselects a selected list option, if its value is changed to something that doesn't match up with the group.
s2-abdo pushed a commit to s2-abdo/material2 that referenced this pull request Jan 18, 2019
Along the same lines as angular#14734. Deselects a selected list option, if its value is changed to something that doesn't match up with the group.
vivian-hu-zz pushed a commit that referenced this pull request Jan 18, 2019
Along the same lines as #14734. Deselects a selected list option, if its value is changed to something that doesn't match up with the group.
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
...anymore
Handles the case where a radio button is selected and then its value is changed to something that doesn't match up with the group anymore.
@crisbeto crisbeto force-pushed the radio-selected-button-value-change branch from 645e63d to 5a29a88 Compare June 20, 2019 20:57
@crisbeto crisbeto added the P4 A relatively minor issue that is not relevant to core functions label Jun 20, 2019
@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2021
Copy link
Contributor

This change depends on the order Angular sets the button's checked and value properties. When checked is set before value, both the group and button will have a null value and never be selected. However, when value is set first, the evaluation shows that group's value is null and the button has a value so it sets it.

You can test it by comparing the group value between these two cases:

<!-- No button will be selected since the checked setter was called first and it found that the group and buttons all have null values -->
<mat-radio-group>
 <mat-radio-button checked value="1"> Option 1 </mat-radio-button>
 <mat-radio-button value="2"> Option 2 </mat-radio-button>
 <mat-radio-button value="3"> Option 3 </mat-radio-button>
</mat-radio-group>
<!-- The first button will be selected because checked will update the group based on the first button's value -->
<mat-radio-group>
 <mat-radio-button value="1" checked> Option 1 </mat-radio-button>
 <mat-radio-button value="2"> Option 2 </mat-radio-button>
 <mat-radio-button value="3"> Option 3 </mat-radio-button>
</mat-radio-group>

@andrewseguin andrewseguin removed the action: merge The PR is ready for merge by the caretaker label Feb 22, 2022
@andrewseguin andrewseguin removed the P4 A relatively minor issue that is not relevant to core functions label Mar 28, 2022
@josephperrott josephperrott requested a review from a team as a code owner December 18, 2024 17:40
@josephperrott josephperrott requested review from amysorto and mmalerba and removed request for a team December 18, 2024 17:40
@mmalerba mmalerba removed their request for review February 20, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@jelbourn jelbourn jelbourn left review comments

@devversion devversion devversion left review comments

@amysorto amysorto Awaiting requested review from amysorto amysorto is a code owner automatically assigned from angular/components-googlers

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
target: patch This PR is targeted for the next patch release
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /