Skip to content

Commit f6e9faa

Browse files
committed
Add isBlurring flag for .blur and .close methods
Fixes failing test after regression in selectize#1353, while trying to preserve its functionality.
1 parent 74c7cc8 commit f6e9faa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/selectize.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var Selectize = function($input, settings) {
1919

2020
eventNS : '.selectize' + (++Selectize.count),
2121
highlightedValue : null,
22+
isBlurring : false,
2223
isOpen : false,
2324
isDisabled : false,
2425
isRequired : $input.is('[required]'),
@@ -652,10 +653,12 @@ $.extend(Selectize.prototype, {
652653
// IE11 bug: element still marked as active
653654
dest && dest.focus && dest.focus();
654655

656+
self.isBlurring = false;
655657
self.ignoreFocus = false;
656658
self.trigger('blur');
657659
};
658660

661+
self.isBlurring = true;
659662
self.ignoreFocus = true;
660663
if (self.settings.create && self.settings.createOnBlur) {
661664
self.createItem(null, false, deactivate);
@@ -1783,7 +1786,7 @@ $.extend(Selectize.prototype, {
17831786
// Do not trigger blur while inside a blur event,
17841787
// this fixes some weird tabbing behavior in FF and IE.
17851788
// See #1164
1786-
if (self.ignoreFocus) {
1789+
if (!self.isBlurring) {
17871790
self.$control_input.blur(); // close keyboard on iOS
17881791
}
17891792
}

0 commit comments

Comments
 (0)