From 0b8955b792e8821d5e667ea6a9eb78469276578d Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 23 Jan 2018 16:27:44 +0100 Subject: [PATCH] fix(datepicker): calendar keyboard controls not working if the user clicks on blank area (#9494) Fixes the user not being able to use the keyboard controls on a calendar, if they click on one of the blank areas next to a cell. The issue comes from the calendar body not being focusable which ends up returning focus back to the body. --- src/lib/datepicker/calendar.html | 2 +- src/lib/datepicker/calendar.spec.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/datepicker/calendar.html b/src/lib/datepicker/calendar.html index 924d07c4f80..594fc00e1d5 100644 --- a/src/lib/datepicker/calendar.html +++ b/src/lib/datepicker/calendar.html @@ -21,7 +21,7 @@
+ [ngSwitch]="_currentView" cdkMonitorSubtreeFocus tabindex="-1"> { expect(calendarInstance._activeDate).toEqual(new Date(2017, JAN, 31)); }); + it('should make the calendar body focusable', () => { + expect(calendarBodyEl.getAttribute('tabindex')).toBe('-1'); + }); + describe('month view', () => { it('should decrement date on left arrow press', () => { dispatchKeyboardEvent(calendarBodyEl, 'keydown', LEFT_ARROW);