Skip to content

bug(Form Controls): FormControl disabled state now overrides the template state #26302

@zakhenry

Description

@zakhenry

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

14

Description

This is a regression, before the [disabled] attribute of a form element (radio, toggle etc) would take precedence, but now this attribute appears to be ignored entirely if the component is bound to a form control

Before:
https://stackblitz.com/edit/angular-pw8j5w?file=src/app/radio-ng-model-example.html
Screenshot 2022-12-21 at 11 22 43

After:
https://stackblitz.com/edit/angular-tomdov?file=src/app/radio-ng-model-example.html
Screenshot 2022-12-21 at 11 22 49

Note the content of these demos are identical other than the different bootstrapped version, one is showing the control as disabled (v14) and the other as enabled (v15)

Reproduction

Steps to reproduce:

  1. Set up a form component with a [disabled]="true" attribute
  2. Attach a formControl via [formControl] with no disabled state set (the default)
  3. Inspect the ui

Expected Behavior

Form component should be disabled

Actual Behavior

Form component is not disabled

Environment

  • Angular: 15.0.0
  • CDK/Material: 15.0.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

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