From 741e249827747a8a509e47be2fd71d248c7f84a1 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Fri, 7 Jul 2023 14:26:08 -0700 Subject: [PATCH] Fix weird scroll position bug --- src/app/App.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/App.svelte b/src/app/App.svelte index 3a64ce14..28767883 100644 --- a/src/app/App.svelte +++ b/src/app/App.svelte @@ -78,8 +78,13 @@ document.body.style.position = `fixed` } } else if (!isNil(scrollY)) { - document.body.setAttribute("style", "") - window.scrollTo(0, scrollY) + const offset = scrollY + + // I don't know why this timeout is necessary + setTimeout(() => { + document.body.setAttribute("style", "") + window.scrollTo(0, offset) + }, 100) scrollY = null }