Skip to content

Commit

Permalink
Fix cursor problems (flatpickr#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlouie authored and chmln committed Sep 5, 2018
1 parent d42807f commit 03e0077
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,7 @@ function FlatpickrInstance(

if (!e.ctrlKey) focusOnDay(undefined, delta);
else {
e.stopPropagation();
changeMonth(delta);
focusOnDay(getFirstAvailableDay(1), 0);
}
Expand All @@ -1549,9 +1550,12 @@ function FlatpickrInstance(
case 40:
e.preventDefault();
const delta = e.keyCode === 40 ? 1 : -1;

if (self.daysContainer && (e.target as DayElement).$i !== undefined) {
if (
(self.daysContainer && (e.target as DayElement).$i !== undefined) ||
e.target === self.input
) {
if (e.ctrlKey) {
e.stopPropagation();
changeYear(self.currentYear - delta);
focusOnDay(getFirstAvailableDay(1), 0);
} else if (!isTimeObj) focusOnDay(undefined, delta * 7);
Expand Down Expand Up @@ -1612,7 +1616,6 @@ function FlatpickrInstance(
break;
}
}

triggerEvent("onKeyDown", e);
}

Expand Down

0 comments on commit 03e0077

Please sign in to comment.