Skip to content

fix: tutorial scrollymation racing global smooth-scroll CSS - #77

Merged
EDRipper merged 1 commit into
mainfrom
fix/tutorial-smooth-scroll-race
Jul 31, 2026
Merged

fix: tutorial scrollymation racing global smooth-scroll CSS#77
EDRipper merged 1 commit into
mainfrom
fix/tutorial-smooth-scroll-race

Conversation

@EDRipper

Copy link
Copy Markdown
Collaborator

Summary

PR #76 fixed the clamp effect to read window.scrollY directly instead of the lagging reactive binding, but the bug still reproduced on prod after deploy: fresh accounts still snapped straight to Go! on Start.

Actual root cause: frontend/src/routes/+layout.svelte sets scroll-behavior: smooth on html globally. Every window.scrollTo(0, x) call in frontend/src/routes/tutorial/+page.svelte was meant to be an instant jump (the page already does its own manual frame-by-frame easing via requestAnimationFrame), but with no explicit behavior argument each call inherited smooth from that global CSS, so the browser animated it asynchronously on top of the page's own manual animation. When the landing animation finishes and locked flips true, the clamp effect reads the current scroll position expecting it to already be at the landing spot - it isn't, because the browser's own smooth-scroll is still catching up - so it reads a value below top and snaps to the topmost bound (Go!).

Fix: every scrollTo call in the tutorial page that's meant to be instant now explicitly passes behavior: 'instant' to override the CSS.

Reproduced live on a throwaway test account before and after the previous fix; this addresses the actual mechanism instead of a stale-read symptom.

…l smooth-scroll CSS

frontend/src/routes/+layout.svelte sets scroll-behavior: smooth on html
globally. every window.scrollTo(0, x) call in the tutorial page relied on
being instant, but without an explicit behavior it inherited smooth from
that CSS, so the browser animated it asynchronously instead of jumping.
this raced against the page's own manual rAF-driven scroll easing and the
lock/clamp effect, which reads window.scrollY expecting it to already be
at the landing position the moment locked flips true - it wasn't, so the
clamp snapped everyone to the topmost bound (Go!).

fixes it at the source: every scrollTo call meant to be instant now
explicitly passes behavior: 'instant' to override the CSS.
@EDRipper
EDRipper merged commit defca6b into main Jul 31, 2026
7 checks passed
@EDRipper
EDRipper deleted the fix/tutorial-smooth-scroll-race branch July 31, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant