diff --git a/src/components/SearchPanel.tsx b/src/components/SearchPanel.tsx index 41b9c49..460e9c2 100644 --- a/src/components/SearchPanel.tsx +++ b/src/components/SearchPanel.tsx @@ -70,7 +70,11 @@ export function SearchPanel({ const langParam = useMemo(() => langQuery(lang), [lang]); useEffect(() => { - inputRef.current?.focus(); + // Avoid scroll-into-view: browsers default-scroll the focused element + // into the viewport, which moves the underlying page when the search + // overlay opens from a scrolled position. `preventScroll` keeps the page + // exactly where it was. + inputRef.current?.focus({ preventScroll: true }); }, []); useEffect(() => { @@ -133,7 +137,7 @@ export function SearchPanel({ }; return ( -