bug(mat-form-filed): padding added to mat-icon when used as a prefix/suffix does not respect density
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### 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
Any mat-icon with the matPrefix or matSuffix directive applied to it appears to always have this rule
.mat-mdc-form-field-icon-prefix>.mat-icon, .mat-mdc-form-field-icon-suffix>.mat-icon {
padding: 12px;
box-sizing: content-box;
}
This padding is always the same no matter what density used used for the mat-form-field. Causes form-fields to be taller then they should be when they have an mat-icon prefix/suffix and using smaller densities. Aligns the actual input at the top of the form-field.
### Reproduction
Steps to reproduce:
1. Set density for mat-form-field to minimum
2. Create an mat-form-field with a mat-icon as its mat-suffix
https://stackblitz.com/edit/angular-wxbcwr-7qsjkw?file=src%2Fapp%2Finput-prefix-suffix-example.html
The example contains 3 fields, first one uses a mat-icon-button instead of a mat-icon directly, second uses a mat-icon, 3rd wraps the mat-icon in a span.
In cases 1 and 3 no padding is applied, in the second one 12 pixels of padding is applied to the mat-icon regardless of density settings.
### Expected Behavior
Padding applied to mat-icon with a matSuffix/matPrefix directive should be adjusted based on the density of the mat-form-field
### Actual Behavior
Padding for a mat-icon with a matSuffix/matPrefix directive is always 12 pixels.
### Environment
- Angular:
- CDK/Material:
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):
コントリビューションガイド
調査の方向性
まず、issue に記載されている .mat-mdc-form-field-icon-prefix > .mat-icon と .mat-mdc-form-field-icon-suffix > .mat-icon のルールから始め、リンク先の StackBlitz で少なくとも 3 つのケースを最小密度で再現します。完了条件は、直接指定された mat-icon の prefix と suffix の padding が form-field の密度に応じて変化し、mat-icon-button と wrapped-icon のケースでは現在の動作が維持されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, css, typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100