Skip to content

Commit

Permalink
Fix bug selectize#182 (use fix from bbc/selectize.js@ea3f067)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Jacobs committed Apr 9, 2014
1 parent d6a6f53 commit 6e04d7b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var Selectize = function($input, settings) {
isCmdDown : false,
isCtrlDown : false,
ignoreFocus : false,
ignoreBlur : false,
ignoreHover : false,
hasOptions : false,
currentResults : null,
Expand Down Expand Up @@ -156,7 +157,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 @@ -526,6 +527,14 @@ $.extend(Selectize.prototype, {
self.isFocused = false;
if (self.ignoreFocus) return;

// 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;
}

if (self.settings.create && self.settings.createOnBlur) {
self.createItem(false);
}
Expand Down

0 comments on commit 6e04d7b

Please sign in to comment.