bug(material/select): mat-select option is not announced on the very first time options are visible

Aberta
#34,057 1 comentário 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
67/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
angular, typescript

Direção de pesquisa

Start by reading the Angular Material mat-select implementation and its accessibility tests for announcing the active option when the panel opens. Reproduce the issue with the linked reactive-form example and a screen reader, then trace how the initially selected option is announced on open versus after navigating away and back. Done means the selected state is announced on the first open; add or update a regression test for that behavior.

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

Descrição

Accessibility area: material/select P3
  1. 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 a mat-select has an initial value (for example, set through a reactive form control) and the user opens it for the first time, the screen reader reads the active option's text but does not announce it as "selected". If the user moves to different options and returns back to the selected one, the same option is announced correctly as "selected".

Reproduction

StackBlitz link: https://stackblitz.com/edit/3j8yhubg?file=src%2Fexample%2Fselect-reactive-form-example.ts
Steps to reproduce:

  1. Create a mat-select bound to a reactive FormControl with an initial value:
Image
  1. Turn on a screen reader (VoiceOver).
  2. Tab to the select and open it with Space, Enter or Alt+Down
  3. Listen to the announcement for the highlighted option.
  4. Go to next option.
  5. Return to previous option and listen to the announcement. "Selected" is announced for the option which is selected.
Expected Behavior

"Selected" should be announced on the very first time the panel of options open.

Actual Behavior

"Selected" is not announce on the very first time the panel opens and the user is on the selected item. It is announced when the user goes to some different options and returns to the selected item.

Environment
  • Angular: 21.2.22
  • CDK/Material: 21.2.14
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS
Linguagem predominante
TypeScript
Estrelas
25k
Forks
6.9k
Merge médio
2d 7h
PRs com merge (30d)
83

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.