Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosing focus on the field if addItems method is used #2103

Open
5 tasks done
jf-cbd opened this issue May 16, 2024 · 0 comments
Open
5 tasks done

Loosing focus on the field if addItems method is used #2103

jf-cbd opened this issue May 16, 2024 · 0 comments

Comments

@jf-cbd
Copy link

jf-cbd commented May 16, 2024

I did:

  • Search for if my issue has already been submitted
  • Make sure I'm reporting something precise that needs to be fixed
  • Give my issue a descriptive and concise title
  • Create a minimal working example on JsFiddle or Codepen
    (or gave a link to a demo on the Selectize docs)
  • Indicate precise steps to reproduce in numbers and the result,
    like below

Steps to reproduce:

  1. In the following CodePen, when a key is released on an input field, it performs addItem on the selectize.
  2. Try typing a key in the input. The option is added, focus is still on the input field.
  3. Replace the selectize.addItem(optionValue, true); by selectize.addItems([optionValue], true)
  4. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant