mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-23 18:16:23 +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 { quintOut } from 'svelte/easing';
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import type { PageData } from './$types';
|
||||
import type { Patch } from '$lib/types';
|
||||
@ -25,6 +24,7 @@
|
||||
export let data: PageData;
|
||||
$: ({ selectedPkg } = data);
|
||||
|
||||
// Search whatever the s query is from the url
|
||||
let searchTerm = $page.url.searchParams.get('s');
|
||||
let searchTermFiltered = searchTerm
|
||||
?.replace(/\./g, '')
|
||||
@ -79,7 +79,8 @@
|
||||
.replace(/-/g, '')
|
||||
.toLowerCase();
|
||||
// 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);
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user