Listen for focus event on calendar cells - #24279
Conversation
90e63ed to
0ab736c
Compare
0ab736c to
5b3f379
Compare
|
Deployed dev-app to: https://ng-comp-dev--pr-24279-5b3f379a508e0e1f56b26f1428b4b379-dva346t7.web.app |
| '[data-mat-row="1"][data-mat-col="2"] button', | ||
| ) as HTMLElement; | ||
|
|
||
| dispatchFakeEvent(year2022El, 'focus'); |
There was a problem hiding this comment.
Would the test worked if you actually focused the element with .focus()?
There was a problem hiding this comment.
well, not sure exactly what the question is here. If we changed this line to year2022El.focus() then the test would fail when we check that the focusSpy was not called.
An alternative would be to actually focus the element with .focus(), but assert that the focusSpy was called exactly one.
I went with dispathFakeEvent because that's what we use in all the other tests, but I'm open to suggestions.
e35faa8 to
8152864
Compare
|
@jelbourn , I've address the PR comments, and this is ready for your eyes again 👀 |
cb9b201 to
782f893
Compare
782f893 to
0805774
Compare
When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Fixes angular#23483
0805774 to
e82f7a6
Compare
…ell (#24279) When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Fixes #23483 (cherry picked from commit 052b97d)
When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Note that this is the second attempt at this. First attempt was angular#24279, which was reverted in angular#24380 due to an internal issue. Fixes angular#23483
When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Note that this is the second attempt at this. First attempt was #24279, which was reverted in #24380 due to an internal issue. Fixes #23483
…ell (angular#24279) When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Fixes angular#23483
…lendar cell (angular#24279)" (angular#24380) This reverts commit 052b97d.
…lar#24384) When a a date cell on the calendar recieves focus, set the active date to that cell. This ensures that the active date matches the date with browser focus. Previously, we set the active date on keydown and click, but that was problematic for screenreaders. That's because many screenreaders trigger a focus event instead of a keydown event when using screenreader specific navigation (VoiceOver, Chromevox, NVDA). Note that this is the second attempt at this. First attempt was angular#24279, which was reverted in angular#24380 due to an internal issue. Fixes angular#23483
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Description
Please see commit message for description.
Guide to reviewing this
Would probably make the most sense to reviewers to look at code changes in this order:
MatCalendarBody._scheduleFocusActiveCellAfterViewChecked(used for refactoring handingkeydownevents without changing existing behavior)Tests added to src/material/datepicker/month-view.spec.ts(the behavior change this PR creates)MatCalendarBody._cellFocusedMatMonthView._dateBecomesActive