Skip to content

Commit 1703b83

Browse files
committed
fix(material/datepicker): use cdk-visually-hidden on calendar header (#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". (cherry picked from commit 14f5b6e)
1 parent 4128f66 commit 1703b83

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/material/datepicker/month-view.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<table class="mat-calendar-table" role="grid">
22
<thead class="mat-calendar-table-header">
33
<tr>
4-
<th scope="col" *ngFor="let day of _weekdays" [attr.aria-label]="day.long">
5-
{{day.narrow}}
4+
<th scope="col" *ngFor="let day of _weekdays">
5+
<span class="cdk-visually-hidden">{{day.long}}</span>
6+
<span aria-hidden="true">{{day.narrow}}</span>
67
</th>
78
</tr>
89
<tr><th aria-hidden="true" class="mat-calendar-table-header-divider" colspan="7"></th></tr>

0 commit comments

Comments
 (0)