angular / angular/components

bug(form-field): label position doesn't take outline-width into consideration

Abierto
#31,474 3 comentarios 0 reacciones 0 asignados Ver en GitHub
P2
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

When using form-field with the outline appearance, the vertical position of the label isn't taking into consideration the outline width.
which means that the thicker the outline is, the more the label is offset from the center.

Image

When using 2px outline, this is not really visible, unless you dynamically change the outline width from 1px to 2px when hovering the form-field, which is really annoying to experience 😅

![Image](https://github.com/user-attachments/assets/b11d34fb-603d-4ef1-87cf-82d6d023c219)

### Reproduction

https://stackblitz.com/edit/tk7fhpq7?file=src%2Fexample%2Fform-field.scss

### Expected Behavior

The label should remain vertically centered like the input value/placeholder is.

### Actual Behavior

The label isn't vertically centered like the input value/placeholder is.

### Environment

- Angular: 20.0.4
- CDK/Material: 20.0.4
- Browser(s): Chrome 137
- Operating System: macOS

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with the linked StackBlitz reproduction and inspect src/example/form-field.scss to reproduce the outline-label offset with different outline widths. Trace the Angular Material form-field outline label positioning, then verify that the label remains vertically centered like the input value or placeholder across the reported widths.

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
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.