Skip to content

Pin the contents map's track in the window where its sidebar spans the page - #7345

Merged
max-sixty merged 3 commits into
mainfrom
toc-scroll-gap
Nov 27, 2026
Merged

max-sixty merged 3 commits into
mainfrom
toc-scroll-gap

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Makes the contents map's narrowed track position: fixed where its sidebar spans the page, so the trackpad's rubber band past the page's top or end slides the page under the map rather than carrying the map with it. Firefox and Chrome move a stuck sticky box with an overscroll, and every engine holds a fixed box still (notes/browser-support.md); the page-of-parts column already relies on that.

To weigh: a fixed box can't stop at a header or footer or stay inside a sidebar placed among a column's blocks, so the track is fixed only where the sidebar is the page's main itself, with no header in it or before it, no footer in or after it, and no scroll region Leaf marks around it, and only while its aside stands beside the body. --lf-sidebar-spans-page is set beside the end-room rules, which read the same conditions. Elsewhere it sticks as before. 32 of the 33 sidebar pages with a contents map in the maintainer's page store span the page. The fixed track replaces #7308's start hang, which goes; a map in a sidebar with a footer but no header moves 40px at the top again. No package-interface name is added (leaf-dev interface --base).

Max saw the bounce on his review page and asked for position: fixed; he hasn't read the diff. Headless browsers can't overscroll, so he checked it by hand in a preview of his README page: the map stood still.

Codex and Tend reviewed it; their findings on a site header and a scroll region are folded in, and a sidebar inside main or a part, which can have blocks beside it, keeps the sticky track. An author's transform on an ancestor, or a scroller Leaf doesn't mark, would still capture the fixed track. Tests: the map, lens and sidebar layout tests pass in Chromium and Firefox; the nested-sidebar test gains a contents-map case, and a new test keeps the map below a header in, before or above the sidebar's main; each fails without its rule. The stylesheet rule-cost tests pass.

This was written by Claude Code on behalf of max-sixty

…e page

The maintainer saw the contents map bounce with the page in Firefox on macOS
(2026-11-26): the trackpad's rubber band past the page's top or end carries a
stuck sticky box with the page, as notes/browser-support.md records, while
every engine holds a fixed box still. The narrowed spine track is now
`position: fixed` at its sticking line where the sidebar spans the page: it is
the page's Layout box, holds no header or footer, and has no footer after it or
its `main` (`--lf-sidebar-spans-page`, set beside the end-room rules that read
the same conditions), and only while the aside stands beside the body. Elsewhere
the track sticks as before. 32 of the 33 sidebar pages with a contents map in
the maintainer's page store span the page.

The fixed track covers the case #7308's start hang (`--lf-track-start-room`)
served, so the hang goes. A spine map whose sidebar has a footer but no header
moves 40px at the page's top again; none of those 33 pages has one.

The nested-sidebar test now also checks that a contents map in a sidebar among
a column's blocks sticks within it; it fails if the fixed rule reaches that
sidebar. The bounce itself needs a native trackpad fling, which headless
browsers can't supply.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A site header standing before main doesn't stop the sidebar from counting as spanning the page, so the fixed map draws over that header at the page's top. page-layout.md ("Layouts") documents that case: "Content standing beside main in body, such as a site-wide header or footer". The spans-page conditions only check for a footer after the sidebar or after its main, and for a header inside the sidebar. Take <body><header>Site</header><main class="layout-sidebar"><aside><div class="layout-track"><lf-toc></lf-toc></div></aside><div class="layout-column">…</div></main></body>. It matches body > main and neither footer rule, so the track goes fixed at top: calc(var(--lf-top-outer) + var(--lf-sp-4)), and at scroll 0 that puts it on top of the site header. Before this change the track sat in flow below the header until it stuck. The 32-of-33 count from the page store wouldn't show this, since those are Leaf's own pages.

Separately, CI can't check the change's central claim, the map holding still through the rubber band, because headless browsers don't overscroll. The description says that's waiting on Max's hand check, so I'm leaving the verdict to that.

Comment thread browser/layouts.css Resolved
…oll region

Codex's review found the fixed track standing over a header placed before the
sidebar or before its `main`, as a site header, where the sticky track starts
below it; those now leave the sidebar short of spanning the page. The fixed
rule also takes the sticky rule's guard, so a sidebar inside a scroll region
Leaf marks (`--lf-track-scroll-behavior: flow`) keeps its track there. A new
test checks the map starts below a header in the sidebar, before it and before
`main`; it fails for the latter two without the new selectors.
A sidebar inside a layoutless `main` or a part can have blocks before or after it,
which a fixed track would stand over for the whole scroll, so only a sidebar that is
`main` itself, with no header in it or before it and no footer in it or after it,
now spans the page. The rest keep the sticky track. This drops the
`header ~ .layout-sidebar` sibling scan that the rule-cost test refused, and the
site-header case becomes `:where(body > header ~ main).layout-sidebar`, as Tend's
review suggested.
@max-sixty
max-sixty merged commit e23c16e into main Nov 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the toc-scroll-gap branch November 27, 2026 05:27
max-sixty added a commit that referenced this pull request Nov 27, 2026
A column or sidebar page now ends where its content does, as a web page
does. This removes the room below the last line that #7188 added, nearly
a window of blank space (864px on a 999px-tall window). It also removes
everything that existed only for the room: the end-room term in the
sidebar track's hang (#7308), and the test helper that took the room
away for 16 tests.

What a reader sees differently happens only near a page's end. Removing
items there drops what stands above them by the removed height, and
closing a disclosure there drops its summary. `m` lands a question at
the end low in the window rather than at the landing line. Back on a
deck that ends the page brings up a shorter card and carries Back 404px
down from under the pointer. Higher up a page, nothing changes.

Max chose "No room" on his review page after trying each case in a
preview, and asked for it to be merged. He raised the deck's case as a
separate question, so this leaves the deck's code alone. The hold-still
journey lists the deck-back cases under `MOVES_BY_CHOICE`, its list of
choices that bound the guarantee, and `layouts.css` records the rejected
room.

The contents map's fixed track (#7345) and its header and footer
conditions stay, as does the stuck track's hang through the sidebar's
own end padding (#6671). On a copy of the README page in Firefox at
1728×999, the map's top stays at 32px from the page's top to its end.

Tests: I ran every test that took the room away or was adapted to it by
node id in Chromium and Firefox (68 passed, and the two deck-back cases
fail as the journey's list expects), plus the layer model tests and
pre-commit.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants