Skip to content

Commit 0deac48

Browse files
MENDELU: force a permanent scrollbar so reload really stops shifting (#1407)
PR #1406 reserved the scrollbar gutter with `scrollbar-gutter: stable` on `html`, but on this theme that declaration is ignored: `body { overflow-x: hidden }` makes BODY the propagated viewport scroll container, so a gutter set on `html` is never held. Verified on the live build -- clientWidth still toggled 1425<->1440 on every reload, and centred content plus the right-anchored header chrome still jumped by the scrollbar width (the overlay can't hide it: it lives in the page and shifts with it). Force a permanent scrollbar via `overflow-y: scroll` on `html` (previously only in the skipped `@supports not(...)` fallback). Measured per-rAF on the live dev instance in the real-user condition: clientWidth now stays pinned at 1425 across the whole reload (was 1425<->1440). scrollbar-gutter: stable is kept as a progressive enhancement for browsers/themes where it does take effect. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 04766ed commit 0deac48

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/styles/_global-styles.scss

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@ html {
22
position: relative;
33
min-height: 100%;
44

5-
// Always reserve the vertical scrollbar's width. While Angular boots it replaces the
5+
// Keep the vertical scrollbar's width reserved at all times. While Angular boots it replaces the
66
// server-rendered DOM, so the page is briefly too short to scroll: the scrollbar disappears and
7-
// then comes back, widening and re-narrowing the viewport and sliding every centred container
8-
// sideways by half the scrollbar width (~7.5px right, then back). The anti-flicker overlay cannot
9-
// hide that, because the overlay lives in the page and shifts with it.
7+
// then comes back, widening and re-narrowing the viewport and sliding centred content and every
8+
// right-anchored element (search icon, login/user menu) sideways by the scrollbar width, then
9+
// back. The anti-flicker overlay cannot hide that, because the overlay lives in the page and
10+
// shifts with it.
11+
//
12+
// We force a permanent scrollbar with overflow-y: scroll. scrollbar-gutter: stable would be the
13+
// tidier tool (it reserves the space without drawing a track on short pages), but it is IGNORED
14+
// on this theme: `body { overflow-x: hidden }` below makes BODY the propagated viewport scroll
15+
// container, so a gutter declared on `html` is never actually held -- verified on the live build,
16+
// where clientWidth still toggled 1425<->1440 on every reload despite the stable gutter. Making
17+
// `html` a definite scroll container is what pins the width. scrollbar-gutter is kept as a
18+
// progressive enhancement for browsers/themes where it does take effect.
19+
overflow-y: scroll;
1020
scrollbar-gutter: stable;
1121
}
1222

13-
// scrollbar-gutter is unsupported before Chrome 94 / Firefox 97 / Safari 16; keeping the scrollbar
14-
// track permanently visible reserves the same width there.
15-
@supports not (scrollbar-gutter: stable) {
16-
html {
17-
overflow-y: scroll;
18-
}
19-
}
20-
2123
body {
2224
overflow-x: hidden;
2325
}

0 commit comments

Comments
 (0)