Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

bug(MatFormField): Outline form field with prefix labels misalign when the document direction is changed.

Abierto
#33,648 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
angular, typescript

Línea de trabajo

Comienza con la reproducción vinculada de StackBlitz e inspecciona la implementación de Angular Material MatFormField relacionada con las etiquetas de contorno y los prefijos. Alterna la dirección del documento sin volver a renderizar y, después, compara el comportamiento tras volver a renderizar; se considera terminado cuando la etiqueta permanece correctamente alineada al cambiar entre LTR y RTL.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: material/form-field P3
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 the direction property on the document is changed (LTR to RTL and viceversa), outline form fields with a prefix suffer from label misalignment. This presents a problem for apps that have forms and need to support a location switcher that has a RTL language like Arabic.

Reproduction

StackBlitz link: https://stackblitz.com/edit/3rswucyt?file=src%2Fexample%2Fform-field-appearance-example.html
Steps to reproduce:

  1. Observe button in default LTR mode.
Image
  1. Click the "Toggle dir" button to change the direction in the wrapper to RTL
  2. Observe the label is now misaligned, trailing off to the right.
Image
  1. Click the "Rerender" button to remove the form from the dom for one second
  2. Observe that when the component re-renders, the label alignment is correct.
Image
  1. Click the "Toggle dir" button again to set the direction back to LTR
  2. Observe the label is misaligned again, only fixes when re-rendering the button.
Image
Expected Behavior

When changing the direction, the label alignment should react and adjust.

Actual Behavior

The label is not aligning, it seems that it has the calculation obtained from before the direction changed. Since re-rendering the component fixes the problem, it appears that the logic is inside the component, but there is no way to notify the component a re-calculation is needed.

Environment
  • Angular: 22.1.0
  • CDK/Material: 22.1.0
  • Browser(s): Google Chrome, Microsoft Edge, Safari
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 7 h
PR fusionados (30 d)
92

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de angular/components

Todos los issues de angular/components

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.