Skip to content

Commit 5728dfb

Browse files
committed
fix(material/datepicker) debugging VoiceOver not reading date on PageDown
Do not merge this pls. Debugging issue #2430. There seems to be two issues 1. The screenreader focus doesn't not match the browser focus 2. the aria-live region is interfering with reading the focused element Adds a timeout to fix #1, and removes the aria-live region to fix #2. This is not the final solution, requires more investigation... Relates to #24330
1 parent 75cda48 commit 5728dfb

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/material/datepicker/calendar-body.ts

+15-13
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,23 @@ export class MatCalendarBody implements OnChanges, OnDestroy {
197197

198198
/** Focuses the active cell after the microtask queue is empty. */
199199
_focusActiveCell(movePreview = true) {
200-
this._ngZone.runOutsideAngular(() => {
201-
this._ngZone.onStable.pipe(take(1)).subscribe(() => {
202-
const activeCell: HTMLElement | null = this._elementRef.nativeElement.querySelector(
203-
'.mat-calendar-body-active',
204-
);
205-
206-
if (activeCell) {
207-
if (!movePreview) {
208-
this._skipNextFocus = true;
200+
setTimeout(() => {
201+
this._ngZone.runOutsideAngular(() => {
202+
this._ngZone.onStable.pipe(take(1)).subscribe(() => {
203+
const activeCell: HTMLElement | null = this._elementRef.nativeElement.querySelector(
204+
'.mat-calendar-body-active',
205+
);
206+
207+
if (activeCell) {
208+
if (!movePreview) {
209+
this._skipNextFocus = true;
210+
}
211+
212+
activeCell.focus();
209213
}
210-
211-
activeCell.focus();
212-
}
214+
});
213215
});
214-
});
216+
}, 50);
215217
}
216218

217219
/** Gets whether a value is the start of the main range. */

src/material/datepicker/calendar-header.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<div class="mat-calendar-header">
22
<div class="mat-calendar-controls">
33
<button mat-button type="button" class="mat-calendar-period-button"
4-
(click)="currentPeriodClicked()" [attr.aria-label]="periodButtonLabel"
5-
[attr.aria-describedby]="_buttonDescriptionId"
6-
cdkAriaLive="polite">
4+
(click)="currentPeriodClicked()" [attr.aria-label]="periodButtonLabel">
75
<span [attr.id]="_buttonDescriptionId">{{periodButtonText}}</span>
86
<svg class="mat-calendar-arrow" [class.mat-calendar-invert]="calendar.currentView !== 'month'"
97
viewBox="0 0 10 5" focusable="false">

0 commit comments

Comments
 (0)