From cb364f0ac7ca102e2d5e8731b566aab5e0686504 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 26 Mar 2024 01:51:24 -0700 Subject: [PATCH] feat: focus search input by default --- src/lib/components/chat/ModelSelector/Selector.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte index c4662bc17..e7e2aa6a4 100644 --- a/src/lib/components/chat/ModelSelector/Selector.svelte +++ b/src/lib/components/chat/ModelSelector/Selector.svelte @@ -2,7 +2,7 @@ import { Select } from 'bits-ui'; import { flyAndScale } from '$lib/utils/transitions'; - import { createEventDispatcher, onMount, getContext } from 'svelte'; + import { createEventDispatcher, onMount, getContext, tick } from 'svelte'; import ChevronDown from '$lib/components/icons/ChevronDown.svelte'; import Check from '$lib/components/icons/Check.svelte'; @@ -177,8 +177,9 @@ { + onOpenChange={async () => { searchValue = ''; + window.setTimeout(() => document.getElementById('model-search-input')?.focus(), 0); }} selected={items.find((item) => item.value === value)} onSelectedChange={(selectedItem) => { @@ -203,6 +204,7 @@