From c191fa1806c2d81cdf2da0f7751da1a931ab4a66 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 2 Mar 2015 12:39:00 -0500 Subject: [PATCH] Fixes #1895 issue with popup not reopening on mobile --- RELEASE-NOTES.md | 1 + src/definitions/modules/popup.js | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 73f1606ee..eb4306987 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -14,6 +14,7 @@ **Bugs** - **Dropdown** - Fixes issue where dropdown would not open after restoring previus value on failed `search dropdown` search +- **Popup** - Fix issue with `popup` not re-opening until another element gains focus on a mobile touchscreen - **Popup** - Fix popup not namespacing `window` events and unbinding on `destroy` **Thanks @revov** - **Transition** - Fixes `swing out` animations not working correctly - **Transition** - Fixed display state other than `block` not determined when using `show` and `hide` without an animation diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index aa5194672..2f58ccd05 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -426,13 +426,22 @@ $.fn.popup = function(parameters) { }, startEvent: function() { if(settings.on == 'hover') { - return 'mouseenter'; + return (hasTouch) + ? 'touchstart mouseenter' + : 'mouseenter' + ; } else if(settings.on == 'focus') { return 'focus'; } return false; }, + scrollEvent: function() { + return (hasTouch) + ? 'touchmove scroll' + : 'scroll' + ; + }, endEvent: function() { if(settings.on == 'hover') { return 'mouseleave'; @@ -791,6 +800,7 @@ $.fn.popup = function(parameters) { ; } else if( module.get.startEvent() ) { + console.log(module.get.startEvent()); $module .on(module.get.startEvent() + eventNamespace, module.event.start) .on(module.get.endEvent() + eventNamespace, module.event.end) @@ -813,12 +823,10 @@ $.fn.popup = function(parameters) { close:function() { if(settings.hideOnScroll === true || settings.hideOnScroll == 'auto' && settings.on != 'click') { $document - .one('touchmove' + elementNamespace, module.hideGracefully) - .one('scroll' + elementNamespace, module.hideGracefully) + .one(module.get.scrollEvent() + elementNamespace, module.hideGracefully) ; $context - .one('touchmove' + elementNamespace, module.hideGracefully) - .one('scroll' + elementNamespace, module.hideGracefully) + .one(module.get.scrollEvent() + elementNamespace, module.hideGracefully) ; } if(settings.on == 'click' && settings.closable) {