Skip to content

Commit

Permalink
Prevent scrollbar click from closing dropdown in IE, fixes selectize#182
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb Flippence committed Feb 14, 2014
1 parent d4d208f commit ea3f067
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ $.extend(Selectize.prototype, {
keypress : function() { return self.onKeyPress.apply(self, arguments); },
resize : function() { self.positionDropdown.apply(self, []); },
blur : function() { return self.onBlur.apply(self, arguments); },
focus : function() { return self.onFocus.apply(self, arguments); }
focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); }
});

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

if (document.activeElement === self.$dropdown_content[0]) {
self.$control_input.focus();
// necessary to prevent IE closing the dropdown when the scrollbar is clicked
if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
self.ignoreBlur = true;
self.onFocus(e);

return;
}

Expand Down

0 comments on commit ea3f067

Please sign in to comment.