Skip to content

Let a page narrow its own sidebar to the contents map's spine - #7473

Merged
max-sixty merged 5 commits into
mainfrom
agent-ace9c28014375103d
Nov 28, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-ace9c28014375103d

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The contents map rests as its spine only where the page narrows its sidebar, with one rule page-layout.md now teaches: --lf-aside: 56px on main.layout-sidebar, on screen under a mouse. A sidebar page without it shows the open outline in a 240px sidebar. Max picked this option on his review page. It removes the spine declaration key, data-lf-spine, --lf-track-spine and --lf-sidebar-spine. The docs pages, the gallery's versions and topic sample, and the sidebar-contents fixture get the rule and look as before.

To weigh:

  • Agent-written pages now show the outline: in long-document-has-contents, no author on this branch wrote the rule (0 of 3).
  • Under a mouse, the Layout lifts a narrow track beside any body, not only a layout-column, and isolates that body, so a box in it no longer stacks over a z-indexed header outside it.
  • The rule carries screen, which the rule shown to Max lacked; without it paper keeps the 56px sidebar.
  • A narrow track no longer scrolls.
  • A page that narrows a sidebar whose aside comes after the body, or stands beside a second aside, gets a spine whose labels the track clips: the Layout lifts only one aside before the body, and the map reads only its own width. Telling the map which tracks are lifted would take a name the Layout sets, as --lf-track-spine was.

Tests: focused model, registry and runtime tests, 56 browser tests by node id, pre-commit; Chromium and Firefox stills show no visible change where the rule is.

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

The contents map (`lf-toc`) rests as its spine only where the page narrows
its sidebar, with the rule page-layout.md, "A sidebar page", now teaches:

    @media screen and (hover: hover) and (pointer: fine) {
      main.layout-sidebar { --lf-aside: 56px; }
    }

A sidebar page without it shows the map as the open outline in a 240px
sidebar. Max chose this on his review page ("Let each page narrow its own
sidebar") over keeping a declaration for it, so the `spine` declaration
key, the `data-lf-spine` mark Leaf painted for it, `--lf-track-spine` and
`--lf-sidebar-spine` go. `leaf-dev interface --base` lists `spine` and
`--lf-track-spine` removed and nothing added.

Under a mouse, the Layout now lifts every track whose aside is narrower
than 8rem in a sidebar whose one aside comes before its body: the track
lays what its element reveals over the body and paints over it, and stands
fixed where the sidebar spans the page; the body is one stacking context.
Under a mouse, toc.css takes its spine form from a track beside the body
narrower than 6rem. The layouts.css header stated that the Layout narrowed
a sidebar from the `spine` declaration, with a TODO about the names it
cost; it now states that the page narrows its own sidebar, and records the
declaration as the rejected alternative.

Calls beyond the trial Max saw (7e6ccbe890), each his to reverse:
- The page rule carries `screen`. Without it, paper kept the 56px sidebar
  and crushed the printed outline: with `screen` dropped from the
  reference, the spine test's print check fails at 56px.
- Lifting reaches a sidebar's body whatever it is, not only a
  `layout-column`. Under the trial's condition, a page that narrowed a
  sidebar beside its own `div` showed the spine with its labels clipped in
  a track that scrolled sideways, and `page check --render` passed it. The
  cost: every such sidebar's body is isolated under a mouse, so a box in it
  no longer stacks over a z-indexed header outside it.
- The z-index sits on the narrow track rather than on the aside, so a box
  the body fixes over a 240px sidebar keeps the pointer. A narrow track
  that doesn't stick is made `position: relative` for it.
- The spine form asks `--lf-track-beside: 1`, a fine pointer and 6rem, so
  it appears only in a track the Layout lifts: not in some other narrow
  container, not under touch, and not in an aside of 128-144px, whose
  sticking track (16px narrower) the trial's 8rem took for a spine.

A narrow track no longer scrolls, so it suits what fits its height, as the
map does; the reference advises the map alone there.

The docs home, examples and data-structures pages, the feature gallery's v1
and v2, its topic-contents sample, and the sidebar-contents fixture get the
rule and look as before. Agent-written pages don't: in `leaf-dev eval run
long-document-has-contents --base --repeat 3` every author passed, and none
of the three on head wrote the rule, so their pages now show the outline.

Tests: `spine_sidebar` (render_harness) reads the rule from page-layout.md,
so the spine tests hold the rule the reference teaches. A sidebar the page
leaves alone keeps the outline at 240px, before or after the body, and a
bar the body fixes over it keeps the pointer (fails with the aside's
z-index); the covering test runs beside a column and beside a page's own
body (fails under column-only lifting). Ran: the focused model tests,
build/registry.test.mjs, `pnpm run test:runtime`, 56 browser tests by node
id across the contents, disclosure, native-layout, go-to and journey files,
and pre-commit.

> _This was written by Claude Code on behalf of max-sixty_
The Layout lifted a track whose aside was narrower than 8rem, and the
contents map took its spine form in a track narrower than 6rem. Both grew
with the root font, so at a 32px root font the 240px sidebar a page leaves
alone became a lifted track, fixed with no scroll, around the map's
disclosure, and at 40px the map drew a spine there. The Layout now lifts a
track whose aside is narrower than 128px and the map rests as a spine in a
track narrower than 96px, which a sticking track 16px inside such an aside
always is. The 56px sidebar the page rule sets is unchanged; at 32px and
40px root fonts the 240px sidebar keeps a sticking, scrolling track and the
disclosure. Codex's review found the case. The disclosure, contents and
native-layout browser tests (56, by node id) and the style model tests pass.

> _This was written by Claude Code on behalf of max-sixty_
> _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.

The map now picks its spine form from its own track's width, but the Layout lifts only some narrow tracks. So a narrowed sidebar the Layout doesn't lift shows a spine whose labels the track clips. Details are on toc.css.

Comment thread packages/default/styles/toc.css Resolved
…ine's labels clip

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit fcc4cb7 into main Nov 28, 2026
9 checks passed
@max-sixty
max-sixty deleted the agent-ace9c28014375103d branch November 28, 2026 00:57
max-sixty added a commit that referenced this pull request Nov 28, 2026
Removes the fixed positioning the Layout gave a narrow sidebar track
(the contents map's spine) where the sidebar was the page's `main` with
no header or footer, along with `--lf-sidebar-spans-page` and the four
rules that read the page's header and footer to set it. Every sidebar
track now sticks.

Since #7473 a page narrows its own sidebar for the spine, so the fixed
track held still on none of the maintainer's 37 sidebar pages with a
map; holding the open outline still too would stand it 40px above the
page's first line on arrival. The maintainer chose to drop it.

What changes for a user: on a spine page with no header or footer, such
as Leaf's site, the map opens level with the page's first line, rises
40px before it sticks, and moves with the rubber band in Firefox and
Chrome, as outline pages already do. The decision is recorded in the
`layouts.css` header.

Tests: the two browser tests of the fixed track's conditions go; the
spine test now expects `sticky`. Focused track tests pass in Chromium
and Firefox.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 28, 2026
…ne shows (#7502)

#7473 stopped the Layout from narrowing a sidebar to the contents map's
spine unless the page asks for it. So `COMPOSER_ATTACHMENT_PAGE`'s 240px
sidebar now shows the map as the open outline, and the outline hides its
title row (`.lf-toc-start`, `packages/default/styles/toc.css`). The five
tests took the first `#bg-contents a`, which is now that hidden title
link with no box. Tab can't focus it, so `_open_attachment_draft` gave
up after 50 presses. The other contents links are still reachable: a Tab
walk on the page focuses First section, Second section, A tabbed section
and Reading space in turn. The failure came from what the test aimed at;
it is not a regression for users.

The tests now aim at `#bg-contents a[href='#first']`, a link the outline
shows. The draft's anchor is still the map's section (`{"section":
"bg-contents"}`), so the tests protect the same behavior as before: a
draft whose subject CSS later hides at 480px stays reachable and keeps
its words. This keeps #7473's intent and changes no interface.

The five tests in #7496 fail on `d0618e073` and pass with this change
when run by node id with `-n 3`:

- `test_a_withheld_draft_restores_editing_and_deliberate_dismissal`
-
`test_explicit_reopening_keeps_a_css_hidden_subject_draft_reachable[resume|reload|withheld|comment]`

Closes #7496 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 28, 2026
…a block's top (#7536)

This fixes four of the eight journeys #7528 tracks: both `column` cases
of the placement sweep, and both cases of the responsive-draft aim
journey.

**Placement sweep, product fix.** #7442 moved where a bounded block's
top starts cutting a margin card. The cut now starts a head line
(`--lf-card-line`, 33px) and a gap above the row's line, so a card
beside its row, whose top now stands that far above the line, is cut
from nothing. `commentBoundary` applied that lead to every side. A card
over or under its row has no head line level with the row, so the
block's top cut it while the row still showed whole. At 1000px the sweep
opened a card above `#in-4`, a row 39px inside the `#inner` log, and
379px of the card's 402 were cut away. The boundary's `cut` is now asked
with the side (`thread-preview.js`). A card beside its row keeps #7442's
lead, and a card over or under it is cut once the row's line comes
within a gap of the edge, as before #7442.

**Placement sweep, test update.** At 1440px the card stands beside the
row, held up by the window's foot, and is cut 35.7px while the row shows
whole. That is #7442's intended lead. The sweep's `uncut-while-shown`
allowance assumed a beside card's top stood a gap above the line. It now
allows a gap and a head line for a card beside its row, and still allows
only a gap for a card over or under it.

**Aim journey, test update.**
`test_open_draft_retains_words_when_responsive_layout_hides_its_target`
aimed at the first `#bg-contents a`. Since #7473 that is the outline's
hidden title link, which Tab never reaches. #7473 landed after #7442, so
this pair is a #7473 casualty, the same one #7502 repaired in five
browser tests. The journey now aims at `#bg-contents a[href='#first']`,
as #7502 did.

Evidence, by node id on Linux Chromium:
- `test_every_card_keeps_the_placement_rules[column-1000]` and
`[column-1440]` fail on `6313a6f59`, and pass with this change.
`[column-1000]` still fails with the test update alone, which shows the
product fix is needed.
-
`test_open_draft_retains_words_when_responsive_layout_hides_its_target[False]`
and `[True]` fail on `6313a6f59` and pass with this change.
- The other four sweep cases still pass, and so does
`test_a_card_on_a_log_row_stands_beside_the_log_and_leaves_with_its_row`,
#7442's test of a beside card's cut growing from nothing.
`tests/runtime/comment-placement.test.mjs` passes.

The other four journeys in #7528 (two margin-draft journeys, the thread
walk and the long text document) are not touched here.

Refs #7528 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
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