bug(mat-form-field): mat-label incorrectly displayed at init (behavior possible)
- 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
Sometimes, when the component mat-form-field is initied too fastly, when we use mat-icon with the attribute matPrefix or matSuffix, the mat-label is misplaced only at the init of the entire component.
A possible behavior can be to initialize the mat-form-field with setTimeout at 100ms or more after the component loaded on ngOnInit().
But, when using ReactiveFormsModule, an error (NG01050: formControlName must be used with a parent formGroup directive) can still be present but the forms works **normally.**
### Reproduction
Steps to reproduce:
1. Create a mat-form-field
2. Add a mat-label to this one
3. Add a trailling mat-icon with matPrefix or matSuffix
### Expected Behavior
The mat-icon and mat-label must be placed normally, means the icon must be before the mat-label for example.
### Actual Behavior
The label must be placed after the icon for matSuffix but only at init he is misplaced above or below the mat-icon. The mat-label works normally after he is focused.
### Environment
- Angular: Angular 15.0.0
- CDK/Material: 15.2.2
- Browser(s): Brave, Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Guía de contribución
Línea de trabajo
Comienza reproduciendo el caso de inicialización con Angular Material mat-form-field, mat-label, mat-icon y matPrefix o matSuffix, incluido el escenario de ReactiveFormsModule descrito. Inspecciona la inicialización de mat-form-field y el momento en que se ejecuta ngOnInit; después, verifica que el icono y la etiqueta estén correctamente posicionados en el primer renderizado, sin el error de formControlName indicado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 32/100