Skip to content

Commit c72add6

Browse files
authored
fix(material/datepicker): datepicker doesn't announce newly selected range in firefox (#28529)
* fix(material/datepicker): multi-year view changes in datepicker doesn't announce selected year range Fixes a bug in the Angular Material component where when the selected year range is updated by moving foward to the next range or by moving to the previous range the screenreader announces the original date range rather than the newly selected date range. This because the class was removing the new value from the Firefox accessibility tree. Fixes #28360 * !fixup fix(material/datepicker): multi-year view changes in datepicker doesn't announce selected year range Adds comment in html file to connect the filed Firefox issue with the workaround. Fixes #28360
1 parent 94306f3 commit c72add6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/material/datepicker/calendar-header.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<div class="mat-calendar-header">
22
<div class="mat-calendar-controls">
3+
<!-- [Firefox Issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1880533]
4+
Relocated label next to related button and made visually hidden via cdk-visually-hidden
5+
to enable label to appear in a11y tree for SR when using Firefox -->
6+
<label [id]="_periodButtonLabelId" class="cdk-visually-hidden">{{periodButtonDescription}}</label>
37
<button mat-button type="button" class="mat-calendar-period-button"
48
(click)="currentPeriodClicked()" [attr.aria-label]="periodButtonLabel"
59
[attr.aria-describedby]="_periodButtonLabelId" aria-live="polite">
@@ -25,4 +29,3 @@
2529
</button>
2630
</div>
2731
</div>
28-
<label [id]="_periodButtonLabelId" class="mat-calendar-hidden-label">{{periodButtonDescription}}</label>

src/material/datepicker/calendar.scss

-4
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,3 @@ $_tokens: tokens-mat-datepicker.$prefix, tokens-mat-datepicker.get-token-slots()
174174
content: '';
175175
}
176176

177-
// Label that is not rendered and removed from the accessibility tree.
178-
.mat-calendar-hidden-label {
179-
display: none;
180-
}

0 commit comments

Comments
 (0)