From 85620f3c36f71ecead94e771e6985e32a578eba2 Mon Sep 17 00:00:00 2001 From: mestremuten Date: Mon, 9 Mar 2015 17:26:56 +0100 Subject: [PATCH 1/2] Clicks: month/year selects + overlay to close --- src/picker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/picker.js b/src/picker.js index 52e7d05..d85f646 100644 --- a/src/picker.js +++ b/src/picker.js @@ -610,7 +610,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // When something within the root holder is clicked, stop it // from bubbling to the doc. - P.$root.on('mousedown click', function( event ) { + P.$root.on('click', function( event ) { var target = event.target @@ -623,7 +623,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // prevent cases where focus is shifted onto external elements // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120). // Also, for Firefox, don’t prevent action on the `option` element. - if ( event.type == 'mousedown' && angular.element( target )[0].tagName !== 'input' && target.nodeName != 'OPTION' ) { + if ( event.type == 'mousedown' && angular.element( target )[0].tagName !== 'input' && target.nodeName != 'SELECT' && target.nodeName != 'OPTION' ) { event.preventDefault() @@ -631,6 +631,8 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // from elements focused within the picker. ELEMENT.focus() } + } else if ( P.get('open') ) { + P.close() } }); From 4ed4b2f86e311358b86a919021a9ceb26f84c2f8 Mon Sep 17 00:00:00 2001 From: mestremuten Date: Mon, 9 Mar 2015 17:32:52 +0100 Subject: [PATCH 2/2] Update picker.js --- src/picker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/picker.js b/src/picker.js index d85f646..587577f 100644 --- a/src/picker.js +++ b/src/picker.js @@ -610,7 +610,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // When something within the root holder is clicked, stop it // from bubbling to the doc. - P.$root.on('click', function( event ) { + P.$root.on('mousedown click', function( event ) { var target = event.target @@ -631,8 +631,8 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // from elements focused within the picker. ELEMENT.focus() } - } else if ( P.get('open') ) { - P.close() + } else if ( event.type == 'click' && P.get('open') ) { + P.close(); } });