Skip to content

bug(mat-select): component crashes when the disabled attribute is set undefined programatically #31563

@massimoadriaens

Description

@massimoadriaens

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When we set the disabled state of the MatSelect programmatically to undefined the component crashes and gives a lot of errors like this:

TypeError: can't access property "toString", ctx.disabled is undefined
Angular 4
MatSelect_HostBindings
processHostBindingOpCodes
refreshView
detectChangesInView

Reproduction

StackBlitz link: https://stackblitz.com/edit/mat-select-disabled-undefined?file=src%2Fmain.ts
(The MatSelect is not properly working in StackBlitz. I don't know why, but I tested it locally and there I get the error)

Steps to reproduce:

  1. Add mat-select to a template
  2. Set the disabled attribute to undefined programmatically

Expected Behavior

When the disabled state for MatSelect is set programmatically to undefined, it should behave like it is has the value false and not crash

Actual Behavior

Component stops working and is giving a lot of error messages

Environment

  • Angular: 20.1.1
  • CDK/Material: 20.0.5
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): maxOs Sequoia 15.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions