From 63b5d6e3a2d2294572c550526006824bf353d400 Mon Sep 17 00:00:00 2001 From: 719media <719media@users.noreply.github.com> Date: Wed, 19 Apr 2017 14:54:28 -0700 Subject: [PATCH 1/2] fix blurring of menu if you click and hold (without releasing mouse), the dropdown will still blur/hide. This is because the order of events goes mousedown -> blur -> mouseup -> click So basically you must click "quickly" or lose the menu --- src/jquery.autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 91afcab5..d1a19787 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -198,7 +198,7 @@ that.select($(this).data('index')); }); - container.on('click.autocomplete', function () { + container.on('mousedown.autocomplete', function () { clearTimeout(that.blurTimeoutId); }) From 67d4b7d750700f53e0339d7c4390f5c7fc2a5891 Mon Sep 17 00:00:00 2001 From: 719media <719media@users.noreply.github.com> Date: Wed, 19 Apr 2017 15:09:21 -0700 Subject: [PATCH 2/2] Update jquery.autocomplete.js --- src/jquery.autocomplete.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index d1a19787..bbcf6bc4 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -198,8 +198,8 @@ that.select($(this).data('index')); }); - container.on('mousedown.autocomplete', function () { - clearTimeout(that.blurTimeoutId); + container.on('mousedown.autocomplete', function (e) { + e.preventDefault(); }) that.fixPositionCapture = function () { @@ -229,13 +229,7 @@ }, onBlur: function () { - var that = this; - - // If user clicked on a suggestion, hide() will - // be canceled, otherwise close suggestions - that.blurTimeoutId = setTimeout(function () { - that.hide(); - }, 200); + this.hide(); }, abortAjax: function () {