fix: make window the vertical scroller so back-to-top works

body had height:100% + overflow-x:hidden, which forces computed
overflow-y to `auto` — turning body into its own scroll box at viewport
height. window.scrollY then never moved, so the back-to-top button never
appeared and window.scrollTo was a no-op.

Apply overflow-x:hidden to <html> only; it propagates to the viewport
(still clipping horizontal overflow) while leaving the window as the
vertical scroller.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
TerryM
2026-05-29 13:30:44 +08:00
parent 4f6b4a498f
commit cfae09a7d3

View File

@@ -8,8 +8,12 @@ body,
height: 100%;
}
html,
body {
/* Only clip horizontal overflow on <html>; this propagates to the viewport
and keeps the window as the vertical scroller. Adding overflow-x to <body>
(which has height:100%) would force its computed overflow-y to `auto`,
turning body into its own scroll box so window.scrollY never moves — which
breaks scroll-position features like the back-to-top button. */
html {
overflow-x: hidden;
}