Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datepicker): calendar keyboard controls not working if the user clicks on blank area #9494

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/datepicker/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>

<div class="mat-calendar-content" (keydown)="_handleCalendarBodyKeydown($event)"
[ngSwitch]="_currentView" cdkMonitorSubtreeFocus>
[ngSwitch]="_currentView" cdkMonitorSubtreeFocus tabindex="-1">
<mat-month-view
*ngSwitchCase="'month'"
[activeDate]="_activeDate"
Expand Down
4 changes: 4 additions & 0 deletions src/lib/datepicker/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ describe('MatCalendar', () => {
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);
Expand Down