From ff6f5958d0027abde8171c83c0e70663bad4a536 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 16 Feb 2025 17:05:56 +1300 Subject: [PATCH] Focus search --- materialious/src/lib/components/Search.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/materialious/src/lib/components/Search.svelte b/materialious/src/lib/components/Search.svelte index d9a02aaf..0277f9cb 100644 --- a/materialious/src/lib/components/Search.svelte +++ b/materialious/src/lib/components/Search.svelte @@ -3,7 +3,7 @@ import { goto } from '$app/navigation'; import Mousetrap from 'mousetrap'; - import { createEventDispatcher, onMount } from 'svelte'; + import { createEventDispatcher, onMount, tick } from 'svelte'; import { _ } from 'svelte-i18n'; import { getSearchSuggestions } from '../api'; import { @@ -108,6 +108,8 @@ bind:value={search} onclick={async () => { showSearchBox = true; + await tick(); + document.getElementById('search')?.focus(); }} /> {#if showSearchBox} @@ -117,6 +119,7 @@