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

[Bug]: text search field value is not cleared after an option is selected #815

Open
lovasoa opened this issue Nov 22, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@lovasoa
Copy link

lovasoa commented Nov 22, 2024

Bug description

When using the text search field in Tom Select.js, the entered search query remains in the input field after selecting an option. This requires the user to manually clear the existing text before searching for another option. No errors are logged in the console during this behavior.

Expected behavior

After selecting an option:

  • The text search field should automatically clear.
  • The user should be able to start typing a new search query without manual input clearing.

The correct behavior is observed everywhere on the official site https://tom-select.js.org/, but the person who wrote the example seems to have manually worked around the bug by adding the following to the options.

onItemAdd:function(){
  this.setTextboxValue('');
  this.refreshOptions();
}

In my opinion, the behavior exhibited on the official site is correct and should be the default.

Steps to reproduce

  1. Go to https://jsfiddle.net/rsj4hgd7/
    image
  2. Start searching for an option. For instance, type "or"
    image
  3. Click the first proposition
    image
  4. After clicking, the search box displays a confusing message saying "No results found". Of course a result was found: I just clicked it! Now if I want to search for a new option, I have to manually delete the "or", then start typing the new option

Additional context

  • OS: all
  • Browser firefox
  • Version 2.4.1

Intially reported in sqlpage/SQLPage#704

@lovasoa lovasoa added the bug Something isn't working label Nov 22, 2024
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