feat: enter to select first format

This commit is contained in:
JovannMC 2025-05-28 22:16:28 +03:00
parent 35a97920aa
commit dee3a0bf3b
No known key found for this signature in database
1 changed files with 10 additions and 0 deletions

View File

@ -233,6 +233,15 @@
}
};
const onEnter = (event: KeyboardEvent) => {
if (event.key === "Enter") {
event.preventDefault();
if (filteredData.formats.length > 0) {
selectOption(filteredData.formats[0]);
}
}
};
onMount(() => {
const handleClickOutside = (e: MouseEvent) => {
if (dropdown && !dropdown.contains(e.target as Node)) {
@ -326,6 +335,7 @@
class="flex-grow w-full !pl-11 !pr-3 rounded-lg bg-panel text-foreground"
bind:value={searchQuery}
oninput={handleSearch}
onkeydown={onEnter}
onfocus={() => {}}
id="format-search"
autocomplete="off"