bug(mat-form-filed): padding added to mat-icon when used as a prefix/suffix does not respect density
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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):
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con le regole .mat-mdc-form-field-icon-prefix > .mat-icon e .mat-mdc-form-field-icon-suffix > .mat.icon descritte nell’issue, quindi riproduci almeno i tre casi nello StackBlitz collegato con la densità minima. Il lavoro è completato quando il padding dei prefissi e suffissi mat-icon diretti cambia con la densità del form-field, mentre i casi mat-icon-button e wrapped-icon mantengono il comportamento attuale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, css, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100