Skip to content

Commit 14f5b6e

Browse files
authored
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".
1 parent b7b96b7 commit 14f5b6e

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)