Skip to content

Conversation

kush-savani
Copy link
Contributor

@kush-savani kush-savani commented Aug 30, 2022

When button-toggle have init value as null, it's not get selected. This fix remove condition which stopping null button to select.
FYI: there is no null check on the value of the radio buttons for selection. Ref

Fixes #25472

Copy link
Contributor

@zarend zarend left a comment

Choose a reason for hiding this comment

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

the value of a button toggle group is an any, which means it doesn't have to be a string. For that reason, this PR looks reasonable to me.

  /** MatButtonToggleGroup reads this to assign its own value. */
  @Input() value: any;

@josephperrott josephperrott requested a review from a team as a code owner December 18, 2024 17:40
@josephperrott josephperrott requested review from crisbeto and removed request for a team December 18, 2024 17:40
@mmalerba mmalerba self-assigned this Jan 22, 2025
When button-toggle have init value as null, it's not get selected. This fix remove condition which stopping null button to select.

Fixes angular#25472
@mmalerba mmalerba force-pushed the button-toggle-default-value-seletion branch from 5fc95ba to 829d053 Compare January 29, 2025 18:14
@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Jan 30, 2025
@mmalerba mmalerba added the target: patch This PR is targeted for the next patch release label Jan 30, 2025
@mmalerba mmalerba merged commit 9ea468a into angular:main Jan 30, 2025
24 of 26 checks passed
@mmalerba
Copy link
Contributor

The changes were merged into the following branches: main, 19.1.x

mmalerba pushed a commit that referenced this pull request Jan 30, 2025
When button-toggle have init value as null, it's not get selected. This fix remove condition which stopping null button to select.

Fixes #25472

(cherry picked from commit 9ea468a)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: material/button-toggle target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(MatButtonToggle): Button with undefined or null value not selected by default

3 participants