Skip to content

Commit

Permalink
fix(material/datepicker): use cdk-visually-hidden on calendar header (a…
Browse files Browse the repository at this point in the history
…ngular#24523)

Use cdk-visually-hidden to announce the days of the week on the calendar header in screenreaders. Previously, this was done with an `aria-label` on the `th` element, but NVDA does not read aria-labels on table elements and well as some other static content.

Fix NVDA incorrectly announcing the days of the week as "M", "T",
etc. instead of "Monday".
  • Loading branch information
zarend authored and forsti0506 committed Apr 3, 2022
1 parent c13d111 commit 552d54d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/material/datepicker/month-view.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<table class="mat-calendar-table" role="grid">
<thead class="mat-calendar-table-header">
<tr>
<th scope="col" *ngFor="let day of _weekdays" [attr.aria-label]="day.long">
{{day.narrow}}
<th scope="col" *ngFor="let day of _weekdays">
<span class="cdk-visually-hidden">{{day.long}}</span>
<span aria-hidden="true">{{day.narrow}}</span>
</th>
</tr>
<tr><th aria-hidden="true" class="mat-calendar-table-header-divider" colspan="7"></th></tr>
Expand Down

0 comments on commit 552d54d

Please sign in to comment.