Skip to content

Commit

Permalink
Add option make keyboard support configurable, fixes Pikaday#607
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Albers committed Nov 10, 2016
1 parent 5f15c0e commit 82c966c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Pikaday has many useful options:
* `onOpen` callback function for when the picker becomes visible
* `onClose` callback function for when the picker is hidden
* `onDraw` callback function for when the picker draws a new month
* `keyboardInput` enable keyboard input support (default `true`)

## jQuery Plugin

Expand Down
10 changes: 8 additions & 2 deletions pikaday.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@
onSelect: null,
onOpen: null,
onClose: null,
onDraw: null
onDraw: null,

// Enable keyboard input
keyboardInput: true
},


Expand Down Expand Up @@ -587,7 +590,10 @@
addEvent(self.el, 'mousedown', self._onMouseDown, true);
addEvent(self.el, 'touchend', self._onMouseDown, true);
addEvent(self.el, 'change', self._onChange);
addEvent(document, 'keydown', self._onKeyChange);

if (opts.keyboardInput) {
addEvent(document, 'keydown', self._onKeyChange);
}

if (opts.field) {
if (opts.container) {
Expand Down

0 comments on commit 82c966c

Please sign in to comment.