Skip to content

bug(matFormField): Form field state not being updated properly when input dynamically changes #28495

Open
@meblum

Description

@meblum

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

version 14

Description

When dynamically changing the input type of a form field, the label and error state of the for field is not properly reflected, the label will not float up and the form outline color will not be set. See demo example

Confirmed that id used to work properly in version 14 see demo working

Reproduction

Steps to reproduce:

  1. open demo
  2. toggle slider
  3. click submit
  4. see that label has not floated and form outline is not red
  5. open v14 demo and see it working properly stackblitz

Expected Behavior

Form field should allow inputs to dynamically change

Actual Behavior

Error state and label are not propely reflected

Environment

  • Angular: 17
  • CDK/Material: 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/form-field

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions