diff --git a/frontend/src/pages/SurveyPage.tsx b/frontend/src/pages/SurveyPage.tsx index 44c0d507..acb8e5ce 100644 --- a/frontend/src/pages/SurveyPage.tsx +++ b/frontend/src/pages/SurveyPage.tsx @@ -188,11 +188,18 @@ export default function SurveyPage() { const goSlide = (idx: number) => { setCurrentSlide(idx) - requestAnimationFrame(() => { - window.scrollTo({ top: 0, behavior: 'smooth' }) - }) } + // Scroll to top whenever the active slide changes + const isFirstRender = useRef(true) + useEffect(() => { + if (isFirstRender.current) { + isFirstRender.current = false + return + } + window.scrollTo({ top: 0, behavior: 'smooth' }) + }, [currentSlide]) + const handleSubmit = async () => { setIsSubmitting(true) setSubmitError('')