mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Element-based scroll tracking broke every time: Bun's HMR destroys the target element, the browser's scroll anchoring picks a different nearby element (e.g. the #downloads CTA) as its new anchor, and the page jumps to wherever that surviving element is. My element-based correction then computes against a replaced DOM node with stale / wrong geometry. The primitive the user actually cares about is window.scrollY — they want the page to stay where it is, regardless of which element survives the patch. Pin scrollY directly: capture it at session start, restore it on every mutation inside the wrapper, re-anchor on user scroll, store it in saveSession for reload-resume. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>