pstanoev / simple-svelte-autocomplete

Simple Autocomplete / typeahead component for Svelte
http://simple-svelte-autocomplete.surge.sh/
MIT License
464 stars 78 forks source link

Do not show clearable when readonly/disabled #146

Open philippone opened 2 years ago

philippone commented 2 years ago

Fixes #145

pstanoev commented 2 years ago

This will also disable the clear in the read-only mode. But in the demo, in readonly mode:

"The readonly attribute is passed to the HTML input. When true then the text input cannot be edited, but items can still be selected in the menu."

Doesn't clear button also make sense in this case?

It doesn't make sense in the disabled mode and that is a bug.

I think I will change the rule to:

$: clearable = !disabled && (showClear || ((lock || multiple) && selectedItem))