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:
@@ -8,8 +8,12 @@ body,
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
/* Only clip horizontal overflow on <html>; this propagates to the viewport
|
||||||
body {
|
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;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user