Skip to content

[Bug]: a form "change" event is fired on blur, when the value did not change #894

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

Open
lovasoa opened this issue Feb 27, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@lovasoa
Copy link

lovasoa commented Feb 27, 2025

Bug description

When the tom select field is blurred, tom select reinitilizes it to an empty state, but still lets a change event bubble up the DOM, while the <select> element value is still the user's search string (that did not match any valid option).

Screencast.From.2025-02-27.15-24-57.mp4

Expected behavior

When the input field is reinitialized, and it was originally empty, then the value did not change, and no change event should bubble up to the parent form component.

Steps to reproduce

  1. Go to https://codepen.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-/pen/gbOLKKv?editors=1011
  2. Start typing something in the input
  3. Click outside the input

Additional context

  • OS: all
  • Browser all
  • Version latest
  • Device: all
@lovasoa lovasoa added the bug Something isn't working label Feb 27, 2025
@lovasoa
Copy link
Author

lovasoa commented Feb 27, 2025

initially reported in sqlpage/SQLPage#832

@lovasoa
Copy link
Author

lovasoa commented Feb 27, 2025

Maybe the additional <input> element that tom-select creates to handle user input should not be linked to the same <form> element as the actual <select> that contains the real values selected by the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant