selectize / selectize.js

Selectize is the hybrid of a textbox and <select> box. It's jQuery based, and it has autocomplete and native-feeling keyboard navigation; useful for tagging, contact lists, etc.
https://selectize.dev/
Apache License 2.0
13.03k stars 3.57k forks source link

Invoking 'load()' does not reset the $activeOption #460

Closed chrisronline closed 3 years ago

chrisronline commented 10 years ago

Is this intentional? If there are existing options in the list and the user starts typing (assuming the selectize control supports remote loading) and new options are loaded and added into the control, the original match against the existing options remains active even if one of the loaded options is scored higher.

Code flow: https://github.com/brianreavis/selectize.js/blob/master/dist/js/selectize.js#L1120 https://github.com/brianreavis/selectize.js/blob/master/dist/js/selectize.js#L1128

This line of code will keep the previously $activeOption the newly active option even though new options are present (and could potentially have a higher match score) https://github.com/brianreavis/selectize.js/blob/master/dist/js/selectize.js#L1446

Along this note, if I go to the demo site (http://brianreavis.github.io/selectize.js/) and use the 'Email Contacts' and: 1) Focus the selectize control so the items dropdown 2) Brian Revis option is "pre-selected" by default (so hitting the Enter key will select that option) 3) Type: 's' 4) The someone option ranks the highest but the Brian Revis option is still "pre-selected" - this seems like incorrect behavior?

rafaelbnp commented 9 years ago

I'm having the same problem as described above.

I have a state dropdown. If I type 'p' let's say it would pre-select Pennsylvania, then I erase 'p' and type 'n' afterwards, Pennsylvania would still be pre-selected not considering the ones high scored from my last search (in this case 'n').

Is this a bug? It doesn't seem right to me.

Thanks

rafaelbnp commented 9 years ago

I can also reproduce this issue in the Demo site and use the Country Selector example.

risadams commented 3 years ago

closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.