[Bug]: text search field value is not cleared after an option is selected
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
- Go to https://jsfiddle.net/rsj4hgd7/
- Start searching for an option. For instance, type "or"
- Click the first proposition
- 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 https://github.com/sqlpage/SQLPage/discussions/704
Maybe this should be a specific option as the default behavior might be useful when performing sequential and/or successive searches
would like it to be optional as mentioned, as something you want to keep the search/filter active. Perhaps clicking outside the selection list (eg back in the main part of the select, or outside the control) could activate the clearing?
I think it should be the default, like on the official website. It is unexpected to see "No results found" immediately after selecting a result.
This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days
still an issue