From 82c966c5107475ba763427be2084eccee0c82e1f Mon Sep 17 00:00:00 2001 From: Ingo Albers Date: Thu, 10 Nov 2016 11:34:29 +0100 Subject: [PATCH] Add option make keyboard support configurable, fixes #607 --- README.md | 1 + pikaday.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f4915a2..e9f09647 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pikaday.js b/pikaday.js index 72fb6021..bda998eb 100644 --- a/pikaday.js +++ b/pikaday.js @@ -262,7 +262,10 @@ onSelect: null, onOpen: null, onClose: null, - onDraw: null + onDraw: null, + + // Enable keyboard input + keyboardInput: true }, @@ -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) {