From 3742c8c2e8af39adb314b00b695ef820e9ac1602 Mon Sep 17 00:00:00 2001 From: Floris Luiten Date: Thu, 27 Oct 2016 11:39:30 +0200 Subject: [PATCH] When the datepicker is attached to a input element and is open, the datepicker should not close but stay in the open state. This also fixes a issue when the datepicker is closed after the user focuses on the input field, additional clicks in the input field do not reopen the datepicker. --- js/foundation-datepicker.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/foundation-datepicker.js b/js/foundation-datepicker.js index a381c33..33bc0ca 100755 --- a/js/foundation-datepicker.js +++ b/js/foundation-datepicker.js @@ -123,6 +123,10 @@ } $(document).on('mousedown', function(e) { + if (that.isInput && e.target === that.element[0]) { + return; + } + // Clicked outside the datepicker, hide it if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) { that.hide();