combobox: don't highlight first item on first open
This commit is contained in:
@@ -114,6 +114,7 @@
|
||||
|
||||
/** stores currently highlighted option (according to keyboard navigation or default item) */
|
||||
let highlighted = $derived.by((): ComboboxOption | undefined => {
|
||||
if (!searching) return undefined; // otherwise, the first item is highlighted on first open
|
||||
if (filteredItems.length === 0) return undefined;
|
||||
if (value !== undefined && filteredItems.find((v) => v.value === value?.value)) return value;
|
||||
if (!filteredItems[0]?.disabled) return filteredItems[0];
|
||||
|
||||
Reference in New Issue
Block a user