Skip to content

Commit 704b47e

Browse files
Autofocus search after modal has been closed
1 parent 9ad4b79 commit 704b47e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lxl-web/src/routes/(app)/[[lang=lang]]/AppSearch.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import addDefaultSearchParams from '$lib/utils/addDefaultSearchParams';
55
import getSortedSearchParams from '$lib/utils/getSortedSearchParams';
66
import { displayMappingToString } from '$lib/utils/displayMappingToString';
7-
7+
import { getCookieConsentContext } from '$lib/contexts/cookieConsent';
88
let cursor: number | null = $state(null);
99
10+
const cookieConsentContext = getCookieConsentContext();
1011
const isHomeRoute = $derived(page.route.id === '/(app)/[[lang=lang]]');
1112
1213
const ariaLabelledBy = $derived(isHomeRoute ? 'page-title' : undefined);
@@ -16,7 +17,7 @@
1617
? `${page.data.t('header.searchSubsetPlaceholder')}: ${displayMappingToString(page.data.subsetMapping)}`
1718
: page.data.t('header.searchPlaceholder')
1819
);
19-
const autofocus = $derived(isHomeRoute ? true : undefined);
20+
const autofocus = $derived(isHomeRoute && !cookieConsentContext.visibleModal ? true : undefined);
2021
2122
const pageParams = $derived.by(() => {
2223
let p = getSortedSearchParams(addDefaultSearchParams(page.url.searchParams));

0 commit comments

Comments
 (0)