fix(combo-box): do not reset selectedIndex to 0, fallback to empty string

This commit is contained in:
Eric Y Liu 2021-07-29 04:55:43 -07:00
commit 0ca50d988e

View file

@ -129,10 +129,6 @@
filteredItems = items.filter((item) => shouldFilterItem(item, value));
} else {
highlightedIndex = -1;
if (!selectedItem) {
selectedIndex = 0;
}
}
});
@ -148,7 +144,7 @@
: undefined;
$: filteredItems = items.filter((item) => shouldFilterItem(item, value));
$: selectedItem = items[selectedIndex];
$: inputValue = selectedItem ? selectedItem.text : undefined;
$: inputValue = selectedItem ? selectedItem.text : "";
$: value = inputValue;
</script>