Skip to content

Commit ea3f067

Browse files
author
Seb Flippence
committed
Prevent scrollbar click from closing dropdown in IE, fixes selectize#182
1 parent d4d208f commit ea3f067

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/selectize.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ $.extend(Selectize.prototype, {
156156
keypress : function() { return self.onKeyPress.apply(self, arguments); },
157157
resize : function() { self.positionDropdown.apply(self, []); },
158158
blur : function() { return self.onBlur.apply(self, arguments); },
159-
focus : function() { return self.onFocus.apply(self, arguments); }
159+
focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); }
160160
});
161161

162162
$document.on('keydown' + eventNS, function(e) {
@@ -519,8 +519,11 @@ $.extend(Selectize.prototype, {
519519
self.isFocused = false;
520520
if (self.ignoreFocus) return;
521521

522-
if (document.activeElement === self.$dropdown_content[0]) {
523-
self.$control_input.focus();
522+
// necessary to prevent IE closing the dropdown when the scrollbar is clicked
523+
if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
524+
self.ignoreBlur = true;
525+
self.onFocus(e);
526+
524527
return;
525528
}
526529

0 commit comments

Comments
 (0)