Skip to content

Commit

Permalink
fix(DatePicker): support focus into a day with min/max (#4793)
Browse files Browse the repository at this point in the history
This change allows user to focus a date into down-arrow key when
min/max dates are enabled. When min/max dates are enabled, there can be
no selected date in the calendar dropdown or calendar dropdown may not
show today, so we need to look for another date to focus on. This
change uses the first focusable date.

Fixes #4207.
  • Loading branch information
asudoh committed Dec 9, 2019
1 parent dce5681 commit e90f5d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react/src/components/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ export default class DatePicker extends Component {
(
cal.selectedDateElem ||
cal.todayDateElem ||
cal.calendarContainer.querySelector('.flatpickr-day[tabindex]') ||
cal.calendarContainer
).focus();
}
Expand All @@ -429,6 +430,7 @@ export default class DatePicker extends Component {
(
cal.selectedDateElem ||
cal.todayDateElem ||
cal.calendarContainer.querySelector('.flatpickr-day[tabindex]') ||
cal.calendarContainer
).focus();
}
Expand Down

0 comments on commit e90f5d4

Please sign in to comment.