Skip to content

Keep a sidebar's stuck track still through the document's end room, and the contents map still from the page's top - #7308

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

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

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Keeps a sidebar's sticky track, and so the contents map, where it sticks through the end room #7188 put on body, and stands the contents map at its sticking line from the page's top. The body's room becomes a token, --lf-end-room, and the track's end margin hangs through it as it already hung through the sidebar's own end padding, where the sidebar is the page's Layout box. Under the narrowed contents map with no header, the track's start margin hangs through the sidebar's top padding. On the maintainer's README page at 1728×999 the map's top went from 64px at the top and −816px at the end to 24px throughout, in Firefox and Chromium.

To weigh: only a footer after the sidebar or its main stops the end hang, since browser extensions append elements to body (all four in the maintainer's Firefox do). Each hang comes off the height the aside asks of the row, so a sticky track taller than the body no longer stretches it: on the triage board with its activity open, the lanes end below their cards.

Max asked on his review page for lf-toc not to scroll; he hasn't read the diff. Codex reviewed it twice; its findings on nested sidebars, a layoutless main's child and a site footer are folded in.

Tests: the track test that #7244 left red passes in both engines with new cases; a new test keeps a sidebar among a column's blocks off what follows it; the lens test checks the map stands still; the rule-cost tests pass.

Closes #7245

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

…nd the contents map still from the page's top

#7188 gave column and sidebar pages a body padding (`--lf-end-room` now) about a
window tall, so the last line can rise to the window's top. A sidebar's sticky
track can't leave its aside, and its end margin hung only through the sidebar's
own 96px end padding, so through the last ~840px of the scroll the track rode up
with the last line and the contents map left the window. #7245 held the test
guarding this red for the maintainer, who asked on his review page that lf-toc
"ideally wouldn't scroll at all".

- The track's end margin now hangs through the document's end room too, where the
  sidebar is the page's Layout box (`main`, a layoutless `main`'s child, or a
  part's box). A footer in the sidebar still stops it, and a footer after the
  sidebar or after its `main` leaves only the sidebar's padding. Only a footer counts after `main`:
  1Password, Readwise, AdBlock and Surfingkeys, all active in the maintainer's
  Firefox, append elements to `body`, and an earlier session found such an
  element after `main` there, so `:has(~ :not(script, template))` (as #6671 had)
  would leave the fix off for him.
- Under the contents map's narrowed sidebar with no header, the track's start
  margin hangs through the sidebar's 72px top padding, so the map stands at its
  sticking line from the first frame rather than moving 40px before it sticks.
  Other tracks keep their place beside the body's top: a start hang there would
  cover a block above the track in the same aside.

Measured on the maintainer's README page at 1728x999 in Firefox and Chromium: the
map's top stood at 64px at the top of the scroll and at -816px at its end, and
now stands at 24px through all 8,098px.

What a user sees differently: each hang comes off the height the aside asks of
the flex row, so a sticky track taller than the body no longer stretches the
row. On the triage board with its activity open, the lanes now end just below
their cards instead of at the activity list's end. The map's first marker opens
34px above the title's baseline instead of 6px, where it stands at every other
scroll position.

Left as rare paths: content other than a footer after `main` stands under the
track at the page's end; a part shorter than a window still carries its map
(the part's `main` is held a window tall, past the sidebar); a track whose own
line-height differs from the body's hangs by its own `1lh`.

Tests: `test_a_stuck_sidebar_track_keeps_its_place_to_the_page_end` passes again
in both engines, now also for a layoutless `main`'s child, beside an element
appended to `body` and above a site footer after `main`; the lens test checks the map stands still at the top, middle
and foot. `without_end_room` zeroes the token, so the track's hang follows.

Closes #7245

> _This was written by Claude Code on behalf of max-sixty_

@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 sidebar nested in a column main now gets the document's end room, so its stuck track paints over the column content that follows it (inline).

Comment thread browser/layouts.css Resolved
`body > main > *` also matched a sidebar inside a `main` that carries its own
Layout, which isn't the page's Layout box: its track hung through the end room
over the column content after it. Only a layoutless `main`'s child counts now,
and a test holds a sidebar among a column's blocks to its own end.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 6ce370c into main Nov 26, 2026
7 checks passed
@max-sixty
max-sixty deleted the toc-scroll-gap branch November 26, 2026 21:16
max-sixty added a commit that referenced this pull request Nov 27, 2026
…e page (#7345)

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_
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.

test_a_stuck_sidebar_track_keeps_its_place_to_the_page_end: a sidebar's stuck track leaves the window in #7188's end room

2 participants