You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
Clicking on another input when selectize has focus does not fire 'focus' event on input (Internet Explorer) #406
Consider a situation where you have a selectize control and another input ("Input A"). The second input has a handler registered to the 'focus' event. In Internet Explorer, if the user clicks into the selectize control and then clicks on "Input A" the focus event is not fired.
The problem seems to be something in selectize's onBlur function, but I haven't been able to pin-point it. Also, the issue is not observed when using the "tab" key to change focus between elements.
I've observed this in IE 11 and simulated versions of IE10 and IE9.
changed the title [-]Clicking on another input while when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/-][+]Clicking on another input when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/+]on May 12, 2014
changed the title [-]Clicking on another input when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/-][+]Clicking on another input when selectize has focus does not fire 'focus' event on input (Internet Explorer)[/+]on May 12, 2014
I have also observed this issue in IE10, IE11. Interestingly, if "Input A" has the HTML5 Placeholder attribute specified, typing (without focus) will append to the placeholder text, and not the change the input value.
This is by no means a solution, but I was able to get around this "ghost-focus" behaviour by manually setting the focus with a jQuery click event handler for Input A:
We have this bug too, even with the latest version ... I've implemented @CountHesley fix and it work well, put I would prefer the library to cleanup correctly!
$document.on('mousedown'+eventNS,function(e){if(self.isFocused){// prevent events on the dropdown scrollbar from causing the control to blurif(e.target===self.$dropdown[0]||e.target.parentNode===self.$dropdown[0]){returnfalse;}// blur on click outsideif(!self.$control.has(e.target).length&&e.target!==self.$control[0]){self.blur();}}});
I suggest to focus on the events target after the blur by calling e.target.focus(). I've tried it locally and it seems to work.
Can someone maybe challenge me about whether it would be a good or bad idea?
Running into the same issue. Our application is data centric with lots of field masks and selectize lists so the issue comes up often. @perrej fix seems to work. Would love to get it put into a future release
Activity
[-]Clicking on another input while when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/-][+]Clicking on another input when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/+][-]Clicking on another input when selectize has focus does not fire 'focus' event on new element (Internet Explorer)[/-][+]Clicking on another input when selectize has focus does not fire 'focus' event on input (Internet Explorer)[/+]CountHesley commentedon Jul 10, 2014
I have also observed this issue in IE10, IE11. Interestingly, if "Input A" has the HTML5 Placeholder attribute specified, typing (without focus) will append to the placeholder text, and not the change the input value.
This is by no means a solution, but I was able to get around this "ghost-focus" behaviour by manually setting the focus with a jQuery click event handler for Input A:
cvillemure commentedon Aug 21, 2014
We have this bug too, even with the latest version ... I've implemented @CountHesley fix and it work well, put I would prefer the library to cleanup correctly!
perrej commentedon Oct 15, 2014
I believe this code to be the culprit.
I suggest to focus on the events target after the blur by calling
e.target.focus(). I've tried it locally and it seems to work.Can someone maybe challenge me about whether it would be a good or bad idea?
bubb-rubb commentedon Dec 10, 2014
Running into the same issue. Our application is data centric with lots of field masks and selectize lists so the issue comes up often. @perrej fix seems to work. Would love to get it put into a future release
perrej commentedon Dec 12, 2014
I created a pull request for this about two months ago.... #599
Merge pull request #599 from perrej/master