Description
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
Not sure if this is a regression or not
Description
The floating label transform is normally applied via the label .mdc-floating-label--float-above
class. However, when matTextPrefix is used on the mat-form-field, the transform is instead applied to the label
element itself via inline style attribute. This makes attaching custom styles to the floated label inconsistent since the inline style has higher specificity than .mdc-floating-label--float-above
class.
Reproduction
Apply matTextPrefix to an outline mat-form-field with a mat-label. Observe how transform styling is applied inline to the label.
https://components-issue-da4zuo.stackblitz.io/
Expected Behavior
I would expect transform styling to be applied consistently via .mdc-floating-label--float-above
class.
Actual Behavior
Transform styling is applied via .mdc-floating-label--float-above
class when matTextPrefix is not present, but applied via inline styling on the label element when matTextPrefix is present.
Environment
- Angular: 16.x
- CDK/Material: 16.x
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS