selectize.js
selectize.js copied to clipboard
Loosing focus on the field if addItems method is used
I did:
- [x] Search for if my issue has already been submitted
- [x] Make sure I'm reporting something precise that needs to be fixed
- [x] Give my issue a descriptive and concise title
- [x] Create a minimal working example on JsFiddle or Codepen (or gave a link to a demo on the Selectize docs)
- [x] Indicate precise steps to reproduce in numbers and the result, like below
Steps to reproduce:
- In the following CodePen, when a key is released on an input field, it performs addItem on the selectize.
- Try typing a key in the input. The option is added, focus is still on the input field.
- Replace the
selectize.addItem(optionValue, true);byselectize.addItems([optionValue], true) - Try typing a key in the input. The option is added, but focus is lost on the input field.
Example : https://codepen.io/grandroot/pen/dyEYVVW
Expected result: Still have the focus on the input
Actual result: Loosing focus
Workaround : Replace
me.addItems(aSelectedItems, true);
By
aSelectedItems.forEach(function(item) { me.addItem(item, true); });
Additional info : Problem happened after migrating from Selectize 0.12.4 to 0.15.2