Skip to content

Button toggle group acts wrong if value is null #14059

Open
@konsultaner

Description

@konsultaner

Bug: If a button in a button group has a value of null, it is not selected on the first button click

What is the expected behavior?

buttuns with a value of null should be selectable

What is the current behavior?

buttons are only sometimes selectable

What are the steps to reproduce?

         <mat-button-toggle-group class="margin-left" [value]="service.booked"  (change)="service.active = $event.value;">
            <mat-button-toggle [value]="true">
                <mat-icon>assignment_turned_in</mat-icon> booked
            </mat-button-toggle>
            <mat-button-toggle [value]="false">
                <mat-icon>find_in_page</mat-icon> not booked
            </mat-button-toggle>
            <mat-button-toggle [value]="null">
                <mat-icon>description</mat-icon> all
            </mat-button-toggle>
        </mat-button-toggle-group>

What is the use-case or motivation for changing an existing behavior?

Java has Boolean values that can eigther be null, true or false. I use this value to map it to a java object.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

definitely angular material 7+

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/button-toggle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions