bug(mat-form-filed): padding added to mat-icon when used as a prefix/suffix does not respect density
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
### 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):
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit den im Issue beschriebenen Regeln für .mat-mdc-form-field-icon-prefix > .mat-icon und .mat-mdc-form-field-icon-suffix > .mat-icon und reproduzieren Sie mindestens die drei Fälle im verknüpften StackBlitz bei minimaler Dichte. Erledigt ist die Aufgabe, wenn sich das Padding direkter mat-icon-Präfixe und -Suffixe mit der Dichte des Form-Felds ändert, während die Fälle mat-icon-button und wrapped-icon ihr aktuelles Verhalten beibehalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, css, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100