mirror of https://github.com/VERT-sh/VERT.git
feat: enter to select first format
This commit is contained in:
parent
35a97920aa
commit
dee3a0bf3b
|
@ -233,6 +233,15 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onEnter = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
event.preventDefault();
|
||||||
|
if (filteredData.formats.length > 0) {
|
||||||
|
selectOption(filteredData.formats[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const handleClickOutside = (e: MouseEvent) => {
|
const handleClickOutside = (e: MouseEvent) => {
|
||||||
if (dropdown && !dropdown.contains(e.target as Node)) {
|
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"
|
class="flex-grow w-full !pl-11 !pr-3 rounded-lg bg-panel text-foreground"
|
||||||
bind:value={searchQuery}
|
bind:value={searchQuery}
|
||||||
oninput={handleSearch}
|
oninput={handleSearch}
|
||||||
|
onkeydown={onEnter}
|
||||||
onfocus={() => {}}
|
onfocus={() => {}}
|
||||||
id="format-search"
|
id="format-search"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
|
|
Loading…
Reference in New Issue