From 5a73385474a6fe9878a15ee3e4a91ca3b39c0c24 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Sat, 14 Jul 2012 09:23:21 +0300 Subject: [PATCH] fixes #194 --- select2.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 855b8d40..00090969 100755 --- a/select2.js +++ b/select2.js @@ -488,11 +488,16 @@ this.highlightUnderEvent(e); this.selectHighlighted(e); } else { - killEvent(e); this.focusSearch(); } + killEvent(e); })); + // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening + // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's + // dom it will trigger the popup close, which is not what we want + this.dropdown.bind("click mouseup mousedown", function (e) { e.stopPropagation(); }); + if ($.isFunction(this.opts.initSelection)) { // initialize selection based on the current value of the source element this.initSelection();