bug(mat-form-filed): padding added to mat-icon when used as a prefix/suffix does not respect density
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
### 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):
Guía de contribución
Línea de trabajo
Comienza con las reglas de .mat-mdc-form-field-icon-prefix > .mat-icon y .mat-mdc-form-field-icon-suffix > .mat-icon descritas en el issue y reproduce como mínimo los tres casos del StackBlitz enlazado con la densidad mínima. Se considera terminado cuando el padding de los prefijos y sufijos directos de mat-icon cambia con la densidad del form-field, mientras que los casos mat-icon-button y wrapped-icon conservan su comportamiento actual.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, css, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100