From 56f02cc19e3fd5cb570fb1385029a4409d1e4adb Mon Sep 17 00:00:00 2001 From: "liu-yang.dz" Date: Fri, 22 May 2026 20:57:12 +0800 Subject: [PATCH] fix(theme-default): stabilize horizontal layout across pages with/without vertical scrollbar On browsers using classic (space-occupying) vertical scrollbars, navigating between a page that triggers the scrollbar and one that does not caused the top nav, content area, and local nav to shift horizontally by ~15 px at viewport widths >= 1440 px. The desktop layout's `100vw`-based centering math is constant, but the container it applies to has `width: 100%` and therefore tracks `html.clientWidth`, which shrinks when the scrollbar appears. Setting `overflow-y: scroll` on `html` reserves the scrollbar gutter at all times, making `html.clientWidth` constant and the layout pixel-stable across navigations. Overlay-scrollbar browsers (macOS Safari, mobile Chrome) are unaffected since overlay scrollbars never consumed layout space. `scrollbar-gutter: stable` was considered but produced no effect in the reporter's browser, suggesting incomplete propagation of the property to viewport-relative measurements; `overflow-y: scroll` is the universal, lowest-friction fix. --- src/client/theme-default/styles/base.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/theme-default/styles/base.css b/src/client/theme-default/styles/base.css index 8041b6bc..d3b82973 100644 --- a/src/client/theme-default/styles/base.css +++ b/src/client/theme-default/styles/base.css @@ -22,6 +22,7 @@ html { line-height: 1.4; font-size: 16px; -webkit-text-size-adjust: 100%; + overflow-y: scroll; } html.dark {