mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-24 18:42:19 +02:00
fix: fix search bar unfocus
This commit is contained in:
parent
f3665d6bda
commit
5c14bd284e
@ -2,7 +2,6 @@
|
|||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import { quintOut } from 'svelte/easing';
|
import { quintOut } from 'svelte/easing';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto } from '$app/navigation';
|
|
||||||
|
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import type { Patch } from '$lib/types';
|
import type { Patch } from '$lib/types';
|
||||||
@ -25,6 +24,7 @@
|
|||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
$: ({ selectedPkg } = data);
|
$: ({ selectedPkg } = data);
|
||||||
|
|
||||||
|
// Search whatever the s query is from the url
|
||||||
let searchTerm = $page.url.searchParams.get('s');
|
let searchTerm = $page.url.searchParams.get('s');
|
||||||
let searchTermFiltered = searchTerm
|
let searchTermFiltered = searchTerm
|
||||||
?.replace(/\./g, '')
|
?.replace(/\./g, '')
|
||||||
@ -79,7 +79,8 @@
|
|||||||
.replace(/-/g, '')
|
.replace(/-/g, '')
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
// Update search URL params
|
// Update search URL params
|
||||||
goto(`${$page.url.pathname}${searchTerm ? '?s=' + searchTerm : ''}`)
|
// must use history.pushState instead of goto(), as goto() unselects the search bar
|
||||||
|
window.history.pushState(null, '', `${window.location.href.split('?')[0]}${searchTerm ? '?s=' + searchTerm : ''}`)
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user