Fix issue with focusout preventing onclick from autocomplete
This commit is contained in:
@@ -117,6 +117,18 @@
|
|||||||
autocompleteList.style.left = `${left}px`;
|
autocompleteList.style.left = `${left}px`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timeout: number;
|
||||||
|
function handleFocusOut() {
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
foodSearch = [];
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFocusIn() {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
updateAutocomplete();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- <svelte:window on:keydown={navigateList} /> -->
|
<!-- <svelte:window on:keydown={navigateList} /> -->
|
||||||
@@ -136,8 +148,8 @@
|
|||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
autofocus
|
autofocus
|
||||||
on:keydown={update}
|
on:keydown={update}
|
||||||
on:focusin={updateAutocomplete}
|
on:focusin={handleFocusIn}
|
||||||
on:focusout={() => foodSearch = []}
|
on:focusout={handleFocusOut}
|
||||||
bind:this={nameElement}
|
bind:this={nameElement}
|
||||||
/>
|
/>
|
||||||
<td
|
<td
|
||||||
|
Reference in New Issue
Block a user