Skip to content

Commit 5a73385

Browse files
committed
fixes select2#194
1 parent 5859dc8 commit 5a73385

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

select2.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,16 @@
488488
this.highlightUnderEvent(e);
489489
this.selectHighlighted(e);
490490
} else {
491-
killEvent(e);
492491
this.focusSearch();
493492
}
493+
killEvent(e);
494494
}));
495495

496+
// trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
497+
// for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
498+
// dom it will trigger the popup close, which is not what we want
499+
this.dropdown.bind("click mouseup mousedown", function (e) { e.stopPropagation(); });
500+
496501
if ($.isFunction(this.opts.initSelection)) {
497502
// initialize selection based on the current value of the source element
498503
this.initSelection();

0 commit comments

Comments
 (0)