This commit is contained in:
Simon Knott 2024-12-11 14:20:54 +01:00
parent 0b0455408f
commit ebf15622e4
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 4 additions and 2 deletions

View file

@ -49,7 +49,9 @@ export const HeaderView: React.FC<React.PropsWithChildren<{
<form className='subnav-search' onSubmit={
event => {
event.preventDefault();
navigate(filterText ? '#?' + new URLSearchParams({ q: filterText }) : '/');
const url = new URL(window.location.href);
url.hash = filterText ? '?' + new URLSearchParams({ q: filterText }) : '';
navigate(url);
}
}>
{icons.search()}

View file

@ -23,7 +23,7 @@ import './links.css';
import { linkifyText } from '@web/renderUtils';
import { clsx } from '@web/uiUtils';
export function navigate(href: string) {
export function navigate(href: string | URL) {
window.history.pushState({}, '', href);
const navEvent = new PopStateEvent('popstate');
window.dispatchEvent(navEvent);