bug(mat-form-field): CSS class generated by controlType of MatFormFieldControl is static, never changes if the control changes #29402
Labels
area: material/form-field
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Is this a regression?
The previous version in which this bug was not present was
No response
Description
mat-form-field
is able to generate a CSS class based on the value of MatFormFieldControl's controlType. The problem is that when theMatFormFieldControl
implementation changes dynamically the field always has the initial MatFormFieldControl CSS class, for example if the initial control is amat-input
and later changes to amat-select
the CSS class on the field will always bemat-mdc-form-field-type-mat-input
Note: The documentation says the prefix for the generated CSS class is
mat-form-field-type
but the real ones have the prefixmat-mdc-form-field-type
. This could be a documentation bug or a regression from the legacy controls, but the prefix is a different bug that this one I am reporting.Reproduction
StackBlitz link: https://stackblitz.com/edit/qbaesq
Steps to reproduce:
mat-input
and the other amat-select
Expected Behavior
No error should be shown because each field switch dynamically the control generated CSS class.
Actual Behavior
Fields don't change to the control CSS class dynamically, it always stays on the same initial class.
Environment
The text was updated successfully, but these errors were encountered: