mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
Two things were wrong. First, I capped large corrections — which was backwards: a huge delta is exactly when we most need to restore (it means the browser's own scroll anchoring drifted, which is what makes the page 'jump to Get Started' when Bun's HMR destroys and re-inserts our target). Remove the cap so any delta is corrected. Second, the browser's built-in scroll anchoring was competing with us: when Bun destroys our target element, the browser picks the nearest surviving element (like a CTA anchor in another section) as its new scroll anchor and scrolls to keep THAT stable. Disable overflow-anchor on html and body for the duration of the session so we own scroll entirely; restore the original values on stopScrollLock. Kept the user-scroll grace window (400ms): wheel / touch / arrow keys re-anchor and suppress corrections, so momentum scrolls don't get fought. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>