From 1b01744efc289be522c7cf737948a806f412eb0d Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Thu, 21 May 2026 07:08:59 +0200 Subject: [PATCH] fix(editor): scroll to top on mount instead of restoring prior position Navigating to /editor (either from /new or by re-importing a PDF) landed the user at the bottom of the page because the browser restored its previous scroll position on a long route. Force a one-shot scroll to (0,0) on mount with an empty-deps effect so the report opens at the header. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/app/routes/EditorRoute.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/routes/EditorRoute.tsx b/src/app/routes/EditorRoute.tsx index f53c9c26..baed3cb6 100644 --- a/src/app/routes/EditorRoute.tsx +++ b/src/app/routes/EditorRoute.tsx @@ -105,6 +105,10 @@ export default function EditorRoute() { if (!report) navigate('/') }, [report, navigate]) + useEffect(() => { + window.scrollTo({ top: 0, left: 0, behavior: 'auto' }) + }, []) + const species = useMemo( () => (report ? getSpecies(report.animal.speciesId) : undefined), [report],