mskocik / svelecte

Flexible autocomplete/select component written in Svelte,
https://svelecte.vercel.app
MIT License
469 stars 42 forks source link

Reset dropdownIndex after value set to null or undefined #195

Closed szegheo closed 8 months ago

szegheo commented 1 year ago

This is not really a bug, rather than an annoying/unusal behaviour IMHO. Steps to reproduce on the Svelecte demo page (Complex playground):

  1. Use "Countries" for the Options
  2. Scroll down a bit and select a country e.g. Greece
  3. Use the "Clear selection" button on the right
  4. Click the select again to open the list
  5. Previous scroll and selection is remembered (highlighted)

In my current project I would really need to let the dropdown scrolled to the top after clearing the current value. I would be fine with a new option to let the component work like this, or with a new API method to do this on my own after value has been cleared. Thank you!

mskocik commented 1 year ago

Done in 3.17.2

szegheo commented 1 year ago

Thank you! Updated and tested but unfortunately it doesn't seem to work. I made a test REPL to demonstrate it. Also tested it on the demo page. Same result 🙁

mskocik commented 1 year ago

I see, I haven't tested this programmatic clear

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 3 days.