Size the viewer to the viewport it has, not the largest one it might get

Reported as: in fullscreen the left rail cannot be scrolled to the bottom, it
looks clipped.

I could not reproduce it. In this environment the browser pane will not
composite frames, so there is no real wheel input and no screenshot, and
`requestFullscreen` needs a gesture and is refused — so the fullscreen case
specifically is untested by me. Everything I could measure came back healthy at
1920x1080, 900x620 and 600x900: the rail scrolls, reaches its last element,
has 17 px under the final control, carries no overlay across its bottom, has no
nested scroll container stealing the wheel, and `100vh` equals `innerHeight`.

What follows is therefore hardening against the mechanism that produces exactly
this symptom, not a confirmed fix, and it is written that way in the CSS.

`#app` was `height: 100vh`. `vh` is the LARGEST the viewport gets, not the size
it currently is, and where the two differ the grid stands taller than the
window. The body clips its overflow, so that difference is not scrollable, it
is gone — and what goes is the bottom of the rail, the one part of this page
with more content than fits. `100dvh` tracks the viewport actually in use, with
`100vh` left above it for anything that does not know the unit. In an ordinary
window they are the same number, which is why this can only ever appear
somewhere they come apart.

`min-height: 0` on the rail closes the neighbouring hole: a grid item's
automatic minimum size is its content, and the browser relaxes that to zero
only for as long as the item stays a scroll container. It is one line of CSS
away from not being one, and then the row grows past the window and takes its
own scrollbar out of reach.

Verified after the change at all three sizes: the grid matches the window
exactly, the body never scrolls, the rail still reaches its last element, and
the stacked narrow layout still splits 414 / 486.
This commit is contained in:
CRTkafa 2026-08-27 15:49:14 +07:00
parent 7bc879b223
commit bc78f295af

View file

@ -32,7 +32,19 @@ html, body {
#app { #app {
display: grid; display: grid;
grid-template-columns: var(--rail) 1fr; grid-template-columns: var(--rail) 1fr;
/*
* `dvh` first, `vh` as the fallback for anything that does not know it.
*
* `vh` is the LARGEST the viewport gets, not the size it currently is. Where
* those differ the grid is taller than the window, and since the body clips
* its overflow the difference is not scrolled to, it is simply gone — and
* what goes is the bottom of the left rail, which is the one part of this
* page that has more content than fits. `dvh` tracks the viewport it
* actually has. They are the same number in an ordinary window, which is why
* this only ever shows up somewhere the two come apart.
*/
height: 100vh; height: 100vh;
height: 100dvh;
background: var(--ink); background: var(--ink);
} }
@ -46,6 +58,15 @@ html, body {
border-right: 1px solid var(--rule); border-right: 1px solid var(--rule);
overflow-y: auto; overflow-y: auto;
overscroll-behavior: contain; overscroll-behavior: contain;
/*
* A grid item's automatic minimum size is its CONTENT, not zero. The rail is
* a scroll container so the browser already relaxes that to zero — but only
* as long as it stays one, and it is one line of CSS away from not being.
* Saying it outright costs nothing and removes the whole failure mode, which
* is the row quietly growing past the window and taking its own scrollbar
* out of reach.
*/
min-height: 0;
} }
.rail::-webkit-scrollbar { width: 10px; } .rail::-webkit-scrollbar { width: 10px; }