bug(mat-form-field): Label for outline mat-form-field is overlapping matPrefix icon in a mat-sidenav
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### 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
_No response_
### Description
I noticed that the `transform` property on the `` for a `mat-form-field` with `appearance="outline"` isn't correctly picking up the width of the icon, if the form field has a `matPrefix`. This is specific to when the form field is within a `mat-sidenav` (perhaps other components that aren't visible on component init, but I haven't tried).
See attached images of the DOM elements and place in the code where this is calculated, plus attached blitz which shows the correct behavior for a `mat-form-field` with `appearance="fill"`


### Reproduction
StackBlitz link: https://stackblitz.com/edit/i6aa9z
Steps to reproduce:
1. Add a `mat-form-field` with a `matPrefix` and `appearance="outline"` to a `mat-sidenav`
2. Toggle the `mat-sidenav` open
### Expected Behavior
Label should be shifted to the left so that it does not overlap the icon
### Actual Behavior
Label is overlapping the prefix icon
### Environment
- Angular: 17.0.0
- CDK/Material: 17.0.4
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS, Windows
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bản tái hiện StackBlitz được liên kết và kiểm tra phép tính biến đổi nhãn outline của mat-form-field khi trường ban đầu nằm trong một mat-sidenav đang đóng. So sánh các kiểu hiển thị outline và fill, sau đó xác minh rằng việc mở sidenav sẽ dịch chuyển nhãn ra khỏi biểu tượng matPrefix.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100