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

Offen
#34,057 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
67/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
angular, typescript

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.9k
Ø Merge
2 T. 7 Std.
Gemergte PRs (30 T.)
83

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus angular/components

Alle Issues in angular/components

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.