angular / angular/components

bug(mat-form-field): Label position is wrong (appearance="outline") when mat-form-field is placed inside drawer

Open
#26,332 4 comments 3 reactions 0 assignees View on GitHub
area: material/form-field P2
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

14

### Description

If the mat-form-field is empty and not focused, then the label moves behind the icon. the error only occurs with appearance="outline" and within a drawer that is not open by default

### Reproduction

Steps to reproduce:
1. place mat-form-field with appearance="outline" inside drawer
2. place icon inside fat-form-field with matPrefix

Demo
https://stackblitz.com/edit/angular-ivy-qb7mbe?file=src/app/app.component.ts
### Expected Behavior

old behaviour

### Actual Behavior

![image](https://user-images.githubusercontent.com/1451287/209673027-d7c82a0f-757f-44ce-9a5c-a1855ad598b4.png)

### Environment

- Angular: 15
- CDK/Material: 15
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and verify the empty, unfocused mat-form-field inside a drawer that is initially closed, using outline appearance and a matPrefix icon. Read the relevant Angular Material form-field and drawer behavior around label positioning. Done means the label no longer moves behind the icon and the reproduction matches the previous behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.