fix: selectors keep focus while adding entries
ci/woodpecker/push/woodpecker Pipeline was successful Details

proper fix requires keeping `hover` over the whole row
refactor/sveltekit
Tomáš Mládek 2023-12-28 21:14:02 +01:00
parent 79b359854b
commit 0690aef307
2 changed files with 6 additions and 0 deletions

View File

@ -107,6 +107,7 @@
export let emptyOptions: SelectorOption[] | undefined = undefined;
export let placeholder = "";
export let disabled = false;
export let keepFocusOnSet = false;
export let initial: SelectorValue | undefined = undefined;
let inputValue = "";
@ -335,6 +336,9 @@
options = [];
optionFocusIndex = -1;
hover = false;
if (keepFocusOnSet) {
focus();
}
}
let listEl: HTMLUListElement;

View File

@ -394,6 +394,7 @@
types={["Attribute", "NewAttribute"]}
on:input={(ev) => (newEntryAttribute = ev.detail.name)}
on:focus={(ev) => (addFocus = ev.detail)}
keepFocusOnSet
bind:this={newAttrSelector}
/>
</div>
@ -402,6 +403,7 @@
<Selector
on:input={(ev) => (newEntryValue = ev.detail)}
on:focus={(ev) => (addFocus = ev.detail)}
keepFocusOnSet
/>
</div>
{:else}