Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#33,648 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
56/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
angular, typescript

Direção de pesquisa

Comece com a reprodução vinculada do StackBlitz e inspecione a implementação do Angular Material MatFormField envolvida nos rótulos de outline e nos prefixos. Alterne a direção do documento sem renderizar novamente e, em seguida, compare o comportamento após renderizar novamente; considera-se concluído quando o rótulo permanece corretamente alinhado ao alternar entre LTR e RTL.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
TypeScript
Estrelas
25k
Forks
6.8k
Merge médio
1d 7h
PRs com merge (30d)
92

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de angular/components

Todas as issues de angular/components

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.