mskocik / svelecte

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

Select is cleared by pressing backspace when clearable is set to false #172

Closed superrnovae closed 1 year ago

superrnovae commented 1 year ago

Title

mskocik commented 1 year ago

It behavies as stated in the documentation:

mskocik commented 1 year ago

There is no option do disable unselecting. You need to add required prop to make it mandatory, which prevents form submission with no value selected.

mskocik commented 1 year ago

After some thinking about this, this feature cannot be added without large unnecessary refactoring to keep current search functionality. When in single-select mode, you cannot search, when there is some option selected. Therefore this would effectively disable searching.

I know that search can be disabled by searchable prop, but with search disabled and forcing selection, native select or custom (ligher) solution can be used as well

clearable bool false Display ✖ icon to clear whole selection