Skip to content

Commit

Permalink
Add hidden textarea for supersearch value in lxl-web
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbissemattsson committed Nov 12, 2024
1 parent f774fe3 commit 7151f73
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lxl-web/src/lib/components/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
let q = $page.params.fnurgel
? '' //don't reflect related search on resource pages
: showAdvanced
? $page.url.searchParams.get('_q')?.trim()
: $page.url.searchParams.get('_i')?.trim();
? $page.url.searchParams.get('_q')?.trim() || ''
: $page.url.searchParams.get('_i')?.trim() || '';
let params = getSortedSearchParams(addDefaultSearchParams($page.url.searchParams));
// Always reset these params on new search
Expand All @@ -30,7 +30,7 @@
/** Update input value after navigation on /find route */
if (to?.url) {
let param = showAdvanced ? '_q' : '_i';
q = $page.params.fnurgel ? '' : new URL(to.url).searchParams.get(param)?.trim();
q = $page.params.fnurgel ? '' : new URL(to.url).searchParams.get(param)?.trim() || '';
}
});
Expand All @@ -45,7 +45,12 @@

<form class="relative w-full" action="find" on:submit={handleSubmit}>
{#if env?.PUBLIC_USE_SUPERSEARCH === 'true'}
<SuperSearch language={lxlQueryLanguage} placeholder={$page.data.t('search.search')} />
<SuperSearch
bind:value={q}
language={lxlQueryLanguage}
placeholder={$page.data.t('search.search')}
/>
<textarea value={q} hidden readonly name="_q" maxlength={2048}></textarea>
{:else}
<!-- svelte-ignore a11y-autofocus -->
<input
Expand Down

0 comments on commit 7151f73

Please sign in to comment.