From 9c7859a88991793548b65be844dc2b0ff726fe56 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 7 Mar 2026 18:22:25 -0500 Subject: [PATCH] fix: scroll to top after survey slide transition renders Use requestAnimationFrame to defer scrollTo until after React renders the new slide content, preventing the browser from staying at the bottom of the page. Co-Authored-By: Claude Opus 4.6 --- frontend/src/pages/SurveyPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/SurveyPage.tsx b/frontend/src/pages/SurveyPage.tsx index f77a2abf..44c0d507 100644 --- a/frontend/src/pages/SurveyPage.tsx +++ b/frontend/src/pages/SurveyPage.tsx @@ -188,7 +188,9 @@ export default function SurveyPage() { const goSlide = (idx: number) => { setCurrentSlide(idx) - window.scrollTo({ top: 0, behavior: 'smooth' }) + requestAnimationFrame(() => { + window.scrollTo({ top: 0, behavior: 'smooth' }) + }) } const handleSubmit = async () => {