Skip to content

Draw the contents map inside its sidebar track - #5637

Merged
leaf-agent merged 2 commits into
mainfrom
contents-map-in-track
Nov 7, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
contents-map-in-track

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

The contents map in a document sidebar is now an ordinary block in its track, with its labels always shown, instead of a fixed 24px spine that revealed labels over the body on hover. That deletes the overlay and the patches each side carried for it, and the sidebar's reserved width now holds the labels instead of standing blank (#5619). Approved direction: #5619 (comment).

Before (contents-map-keyboard, 1440×900, focus on a map link): the labels lie over the first words of the prose.

Before

After: the same map in its own track. Nothing covers the prose, and the column starts where it did.

After

Removed

What users see change

  • No quiet resting state: the labels always show, and pressing a label follows it directly.
  • The map's height fits the stuck track at the document's end, so its start stays in the window (about 700px at a 900px window, was 828). Once its sidebar ends, the map scrolls away with it, as any sticky block does.
  • A block after the map in the track now follows it below, where scrolling the track reaches it. Before, it stood at the track's top beside the spine. page-layout.md and page-authoring.md now say this and suggest putting a status the reader should see at once at the top of the body. No example or docs/ page puts anything after the map.
  • Labels wrap at the track's width (~210px, was ~320px), so close sections pack together one label apart sooner.

--lf-sidebar-slot stays. It still tells the map (margin) apart from the open outline (beside); merging the two is a separate call.

Verification: I ran these locally and they pass: the rewritten journey test_a_margin_table_of_contents_maps_the_document_in_its_track, tests/browser/test_render_toc_disclosure.py, the contents tests in test_contents_and_glosses.py, the go-to hints test, and the render gate on sidebar-contents. The npm-based gates (pnpm run check, prettier, eslint) have no node_modules in this sandbox, so they're left to CI.

Test changes
  • Rewritten to the in-track map: the margin-map journey (the reveal, hover and spine-width steps are gone; it now checks the map stays clear of the body, stays put while its track is stuck, and stays clear of the panel's room), the history, hidden-sidebar and crowded-map tests, the "map only beside the body" test, and the go-to hints test.
  • The status-line test now asserts the status follows the map and a press on it reaches it.
  • Deleted, since their subject is gone: test_the_revealed_margin_map_covers_every_box_the_body_paints and test_the_gate_passes_a_contents_map_resting_as_its_spine.
  • Stills: contents-over-reading is deleted, and contents-spine-keyboard is renamed contents-map-keyboard.

Closes #5619

In margin form the contents map was a fixed 24px spine that revealed its labels over
the body on hover, focus or the go-to sequence. Drawing outside the box its Layout
gave it took a patch on each side: the sidebar Layout stacked its aside over the
body and isolated the body (#5117), toc.css pushed the next block in the track
clear of the spine (#5309, reworked in #5363 and #5370), the render gate exempted a
"resting overlay" from its width floor (#3109), and the sidebar's reserved width
stood blank beside the spine (#5619).

The map is now an ordinary block in its track, with its labels always shown at the
track's width. It keeps the proportional rows, the markers and the lens, and sticks
with the track. Its height fits the stuck track at the document's end, so the map's
start never leaves the window.

Removed: the aside z-index and body isolation in layouts.css, the reveal machinery
in toc.css (hover/focus/go-to widening, the press strip, pointer-events toggling,
the label fade, the `lf-toc + :not(.lf-ui)` clearance rule), and `restsOverPage` in
the render checks.

Behavior changes the tests now hold:
- The map no longer rests as a bare spine; its labels always show, and a press on a
  label follows it directly.
- A block after the map in the track follows it below and is reached by scrolling
  the track (was: beside the map at the track's top, clear of the spine).
- Long labels wrap at the track's width (was ~320px), so close sections pack one
  label apart sooner.
- Once its sidebar ends, the map scrolls away with it, as any sticky block does.

Tests: reveal and overlay assertions rewritten to the in-track map; the overlay
stacking test, the resting-spine render-gate test and the contents-over-reading
state are deleted; contents-spine-keyboard is renamed contents-map-keyboard.

Closes #5619

Co-Authored-By: Claude <[email protected]>

@leaf-agent leaf-agent left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removing the overlay leaves comments outside the diff that still describe it, plus a token nothing reads anymore. I'll push one commit to clean them up:

  • --sidebar-max in browser/styles/tokens.css is documented as "The contents map's unfolded label width". Its only readers were the reveal rules this PR deletes, so the token is now dead.
  • In setGoToSequence (browser/runtime/keyboard/go-to-sequence.js), the comment says the sequence "reveals page navigation such as a roomy contents map" and explains the attribute's ordering by that. No CSS reads data-lf-go-to-active anymore, so the attribute just marks the sequence as armed.
  • The settle_at docstring in src/leaf/render_gate/readings.py justifies finishMoving with the map's label fade, which no longer exists.

--sidebar-max had no reader once the map stopped widening on hover, the go-to
sequence's comment claimed it reveals the map, and settle_at justified
finishMoving by the map's label fade. No behavior changes.
@leaf-agent
leaf-agent merged commit 391c246 into main Nov 7, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the contents-map-in-track branch November 7, 2026 10:20
leaf-agent added a commit that referenced this pull request Nov 8, 2026
…ne (#5696)

This removes four pieces of code nothing reads and corrects comments, a
test docstring, a note and an eval rubric that name things since renamed
or removed. The one change that affects a result is the
`shared-contribution-actions` rubric: it accepted `className`, an entry
option the runtime has refused since #5329, and failed answers that use
`action` or `voice`, which `ENTRY_OPTIONS` accepts. It now lists exactly
the entry options, and a runtime test
(`tests/runtime/contribution-entry-schema.test.mjs`) fails when the
rubric's options, behaviors, tones, ranks or states differ from
`CONTRIBUTION_ENTRY_SCHEMA`, which now also lists the entry options
under `options`. Nothing else changes at runtime.

Dead code:
- `buttonReadings` / `buttonCommand` in `keyboard/scopes.js`. The map
was still filled on every button reflection, but #5638 moved its two
runtime readers (command hints and control keys) onto `reachingNow`.
Five asserts in `tests/runtime/command-controls.test.mjs` read it. Each
of those tests still asserts the button's `aria-disabled`, and where it
presses the button, what the press runs.
- `publishing()` on the application in `framework/application.js`, which
has no caller.
- A second `aria-label` write on the command reference's close control.
`closeControl` already writes that label through `roleElement`.
- `PredecessorReading.committed_active` in
`validation/source_history.py`, which no reader uses. The local variable
of that name still picks the predecessor.

Stale references:
- `undo.js` says a Resolve offers Undo, but since #5630 a Resolve offers
Undo only when it leaves no thread open.
- `traffic.js` says `sends` and `acked` count only `/api/event`, but
they also count `/api/media` uploads.
- `lf-call-diff.js` names `setChildren`; rows are placed with
`setChildLists`.
- `margin-layout.js` and `annotation-theme.css` name `seatRows`, which
is now `seatRow`.
- Three `chrome.css` comments name `foldOut` and `msgNode`, which no
longer exist, or describe a rule that no longer follows them.
- A `tests/browser/margin/test_entries.py` docstring names
`syncInlineOffers`, which no longer exists.
- `notes/feeds/README.md` linked the closed #4058 as open work. It now
points at the `notes/threads.md` section that issue's closing comment
named.

Verified locally:
- `pnpm run test:runtime`: 898 pass. The new test fails when `className`
is put back in the rubric.
- `tsc -p browser/types/tsconfig.json`.
- `pnpm run check:browser` and `pnpm run test:browser`.
- `tests/model/test_interact_document.py` and
`test_interact_anchors.py`: 308 pass.
- pre-commit on the changed files, including knip, eslint and
dependency-cruiser.

Found by the nightly survey and review of recent commits. Two findings
are left out on purpose:
- `data-lf-go-to-active` has lost its only stylesheet reader (#5637),
but ten tests and `dev/leaf_dev/states.py` use it as the signal that the
sequence is armed.
- The developing-leaf glossary still names `seatRows`. It sits under
`.claude/`, which needs the control-plane owner's approval.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 8, 2026
…and (#5719)

A long page lists its threads and decisions in the Page Map, but nothing
showed where they stand along the page. `lf-toc` now marks it on the
contents it already draws, in the gutter beside its rule, as an editor
marks lines beside its text. On the map, an upright bar a line tall just
right of the spine says a section holds open threads (accent) or On me
items (green); while the changes view (`v`) is on, a changed section's
stretch of the spine is drawn in the face a change wears in the margin
(`--lf-change-bar`), under the lens so the lens still shows the part in
view. Where `lf-toc` is the disclosure in the column, or an open
outline, the same bars stand between the outline's rule and its words,
and a changed section is its stretch of that rule. A marked row's link
previews its counts alone, such as "1 thread · 1 waiting on me · 1
change", to a resting pointer, a held finger and keyboard focus, and a
screen reader hears them as the description after the link's name; the
preview leaves out the section's name, which the row's words already
say, so where the only clear room beside a row holds one line, that line
is the count. A row with nothing to count previews nothing, as before.

What stands before the first section, such as a thread on the lede, is
the map's title row's. The column's disclosure and the outline beside
the body leave that row out, since the title stands just above, below or
beside them, so their head carries its marks instead: the disclosure's
toggle while it is open, which Tab reaches, and the outline's "On this
page" label, which a pointer or a held finger reads and which takes no
focus, since the walks and the Page Map reach those threads and
questions by keyboard. Each previews its counts under "Before the first
section", which its face doesn't say.

Marks move nothing and stand outside the words, so none reads as their
punctuation: out of flow, one column at every depth, and taller than any
letter beside them. They hold no control; a press on a row still goes to
its section. The crowded margin's open outline takes the column's rule
and inset, so it has the same gutter. Two other looks were tried and
dropped: a dash after the words, which read as an en dash, and dashes
ticked off the rule with every map label inset 6px further, which
rewrapped labels on every map and stacked into a letter E beside a
changed row in the column.

Which section holds an item is the rule On me groups its items by and a
link's preview names a place by, `partOver` (#5616): an item belongs to
the first contents row met climbing from its element through the parts
over it, so a paragraph under a heading `max-level` leaves out counts in
the row above, and an element a row goes to, such as a whole section a
thread is about, counts in that row. `partOver` is now exported from
`widget-api.js` and documented in `module-reading.md`; that is the only
addition to the public package API. Threads stand at the element their
anchor names, On me items are `obligationsIn(main,
readObligations().user)` at the widget asking each, and changes are
`comparisonChanges(main)`, each counted once per section its blocks
touch; a removal counts in the section it was taken from, so a paragraph
removed from a section's end, whose gap stands before the next heading,
marks the section that held it (`toc-marks.js`).

`lf-toc` is now a `LeafElement` so that it draws again exactly when the
threads, the obligations or the comparison change, and for nothing else:
no scroll, resize, pointer move or keystroke recomputes marks. Its
frame, outline and map geometry stay its own imperative work, drawn into
the same nodes. The map's rows no longer carry `z-index: 2`;
`.lf-toc-rows` isolates its own stacking context instead, so a changed
stretch can sit under the lens.

The row previews exposed a placement defect in the preview owner, fixed
here in `clearRoom` (`preview.js`), outside `stand`. A box around a
preview's subject counted as a control to keep clear of wherever it took
the pointer, and `lf-toc` takes it because it draws its own content, so
inside the contents, drawn across the column at 700px, no side held a
line and a row's count preview stood over the next row. A box around the
subject now counts only where a press acts on it, as the card a press
opens around a chart does (#5617), not where it takes the pointer only
to be read; the controls it holds are still tested for themselves. A
row's preview there now takes the owner's ordinary places, clear of the
rows around it, and covers nothing: in the column at 700px, "Record the
baseline" and "Verify" each preview their one line of counts beside
their words, in Chromium and Firefox, where that room held only part of
a two-line preview before its counts became its whole reading. Dropping
every box around the subject instead broke the chart-in-card guarantee
in both engines.

The `sidebar-contents` fixture now holds seeded threads (one on its
lede, one resolved), two questions and an earlier version, and two
stills states reach it: `contents-marks` and `contents-marks-changes`,
each the spine in a wide window and the opened column outline in a
narrow one.

Tests: `tests/runtime/toc-marks.test.mjs` holds which section each item
counts in (a heading over it, a heading `max-level` leaves out, a whole
section, a nested section, the start row, and a removal before, after or
in an element, a section's end included) and the preview's words. In
`test_contents_and_glosses.py`, one test holds the marks on the map and
in the column, that none stands among a row's words, the previews on
focus, a row's its counts alone, and their descriptions, a count kept
whole where the room beside a row holds one line, the title row's and
the toggle's marks, a thread arriving, the changes view, and that no
mark moves a row; another holds the label's marks beside the body.
`test_previews.py` adds an owner test in both engines, failing before
the fix, that a preview inside a widget drawing its own content stands
whole and clear of the links beside it.
`test_a_route_taller_than_the_map_returns_to_an_open_outline` fails on
main as it does here, inherited from #5637 and tracked in #5705.

Open for review: a thread counts at the element its anchor names
(`anchor.section`), so a passage quoted in a paragraph without an id
counts in the section of the nearest element around it that has one, as
a heading's link preview already counts it; a question asked in a thread
marks only as that thread, since `obligationsIn` places no message
obligation; and the preview owner measures a new reading's height with
the room a previous, fitted reading left it, so Tab from a clamped
preview onto the next can take a side too short for it (seen in Chromium
in the owner test's first draft; not fixed here, since it is in
`stand`).

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

#5637 made a document sidebar's contents map an ordinary block in its
track, where it had been a fixed 24px spine, and removed the `position:
fixed` expectations from the browser tests it touched. The nightly
journey `test_a_layout_on_a_child_of_main_arranges_it_as_it_would_main`
kept one (`assert on_main["contents"][2] == "fixed"`). It has failed
since scheduled run
[42365682113](https://github.com/max-sixty/leaf/actions/runs/42365682113):
`assert 'static' == 'fixed'`.

That line made sure the `lf-toc` had actually drawn as the map before
the test compared a layout on `main` with one on a child of `main`. It
now checks what #5637 guarantees instead: the map's box lies inside its
sidebar track. The comparison itself is unchanged, and no product
behavior changes.

Verification: the journey passes at #5637's parent `119921814` and fails
at `391c24622`, both run locally with `--run-nightly`. With this change
it passes on main `fcad5fa09`.

Refs #4225 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 9, 2026
…paque-background check (#5731)

`test_a_route_taller_than_the_map_returns_to_an_open_outline` has failed
on main since #5637 drew the contents map as a block in its sidebar
track rather than a fixed overlay. Two of its readings still assumed the
overlay. This PR updates the test and changes no product code. #5637's
intent and the outline's behavior both stay as they are.

- **Scroll position.** The "measuring keeps the place the reader
scrolled to" subtest scrolled the outline by writing `scrollTop = 0`
from a script. Leaf doesn't count a script's write as the reader's
gesture, so the page's recorded reading place still named the focused
last link. On resize, `restorePlace`
(`browser/runtime/reading-place.js`) scrolled that link back into view
inside the nav (1727px). The fixed map used to escape this because
`stuckBox` treated it as a stuck box; the in-track map, standing in an
unstuck sticky track, doesn't. The subtest now scrolls with the mouse
wheel, as a reader would, and the position holds at 0 across the 900px
and 700px resizes. It still guards `lf-toc`: with `#fitLabels`'s
"focused link was visible" condition removed, it fails with the same
`1727 == 0`.
- **Opaque background.** #5637 deliberately removed the open outline's
`background: var(--paper)`, since the outline no longer lies over the
document. The assertion just before it, that the outline ends 16px left
of the column at a 1188px window, still covers that guarantee.

Verification: the test fails on current main (`assert 1727 == 0` at line
1205) and passed three of three runs locally with `uv run pytest
--run-main` after the change.

Closes #5705 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 10, 2026
…ts labels over the prose (#5772)

The contents map rests as its spine again, and shows its labels over the
page when the reader points at it, Tabs into it or presses `g`. A
sidebar holding only the map now narrows to 56px, the spine's width,
rather than taking a 240px column, so the prose starts beside the spine.
That fixes the blank strip in #5619 without #5637's always-shown labels.

**At rest** (runbook fixture, 1440×900): before, the labels filled a
column and the prose started at 288px. Now the spine, its dots and the
thread and On Me marks stand in the narrowed sidebar, and the prose
starts at 104px.

![At rest,
before](https://github.com/user-attachments/assets/02eb1ede-8a62-4df1-af34-1f279635b20b)
![At rest,
after](https://github.com/user-attachments/assets/390a8bad-7b98-41e4-a8b4-acbe106cee72)

**Revealed** by keyboard focus on the first section (a resting mouse
shows the same): the labels keep their 320px measure over a 92% paper
ground, as before #5637.

![Revealed,
after](https://github.com/user-attachments/assets/911576bb-54d0-4fe5-ab1d-8b061c0054c3)

**#5619's page of parts** at 1295px: the prose started at 529px with
22px free on the right; it now starts at 345px with 230px free for wide
blocks.

![Parts,
before](https://github.com/user-attachments/assets/92938175-713c-4c47-8188-b3d4601bc20b)
![Parts,
after](https://github.com/user-attachments/assets/0d3b57ac-f69b-4eb5-9c74-68e7d24bee08)

## How the Layout and the map divide the work

- `lf-toc` declares `x-spine`, a new registry key that delivery paints
as `data-lf-spine`, the way a board declares `x-space` for the room it
needs. The word follows the glossary's "contents spine"; "rail" stays
the comment strip's (`data-rail`, `--rail`).
- On a screen under a mouse, a sidebar whose aside comes before a
`layout-column` body and whose track holds only such an element narrows
to `--sidebar-spine` (`layouts.css`). Its track stops clipping and
carries `--lf-track-spine: 1`, the aside paints over the body and the
body is isolated, so the labels cover every box the body draws. The
Layout names no widget.
- The map takes its spine form only in a track the Layout narrowed for
it, too narrow for words (`toc.css`); a track beside the body with room
for words gets the open outline, and any other the disclosure. The map
follows the Layout's decision rather than its own width alone, so a
narrow sidebar a page sets, whose track clips, folds the map into the
disclosure rather than hiding labels it would cut off.
`--lf-sidebar-slot` is deleted.
- At rest a clip-path limits the map's paint and pointer to its own box
in the track, so the labels' measure past it never blocks the prose. The
map stays in flow in the sticky track, so the fixed positioning and the
clearance rule #5637 deleted stay deleted.
- `toc.css` now places everything by logical sides, so the map and the
outline mirror on a right-to-left page, where the resting clip flips.
- A row's thread and On Me marks moved beside its link (`toc-view.js`),
so they show at rest next to the spine.

## Calls to check

- **Only a track holding the map alone narrows.** Narrowing every
document sidebar broke a paragraph in one into a few letters a line, and
`page check --render` passed it. A sidebar holding more keeps its
column, and the map stands open there.
- **Only an aside before the body narrows.** An aside after it keeps its
column and open outline, as on `main`; narrowed, it would need the
labels to spread the other way, toward the body on the inline-start
side.
- **Under touch, and on paper, a document's sidebar keeps its column**,
and its outline stands open there, where under touch it was folded
before.
- **The narrowed sidebar is 56px**: its track's 40px holds the spine,
the marks and a mouse's aim, and clears the render check's 40px widget
floor, so the map needs no exemption.
- **`x-spine` stays for now, with a TODO beside the Layout rule.** It
and the names it brings (`data-lf-spine`, `--sidebar-spine`,
`--lf-track-spine`) widen the public interface for one widget's look.
Narrowing automatically needs some declaration, since the aside is a
size container and takes no width from its content. The alternative,
tried on this branch, lets the page narrow its sidebar with the existing
`--aside`: the Layout lays any track narrower than words over the body,
and the map takes its spine form from its own width. That matched this
branch's geometry in Chromium and Firefox, but makes the spine a look
each page opts into.

## Verification

Ran locally, all passing: every test that composes a document sidebar or
a contents map (found by scanning the suite), the journey
`test_a_contents_spine_maps_the_document_until_the_user_enters_it`, the
registry, schema and delivery tests in `model`/`process`, `pnpm run
check:framework`, `pnpm run test:runtime` (907), and pre-commit. Probed
`docs/index.html` at rest and revealed, and a right-to-left page at rest
and focused, in Chromium and Firefox.

<details><summary>Test changes</summary>

- The margin-map journey is the contents-spine journey again: labels
hidden at rest, revealed by pointing, by go-to and by focus; the prose
starts within 32px of the map; label presses go through the revealed
words; under touch the outline stands open.
- Restored
`test_the_revealed_contents_spine_covers_every_box_the_body_paints`,
which holds the Layout's paint order.
- New
`test_a_contents_spine_rests_beside_the_prose_and_reveals_its_labels_over_it`,
left to right and right to left: at rest nothing of the map lies over
the prose, pointing at the spine shows labels over the body inside the
window, and on paper the sidebar is a column.
- New
`test_a_sidebar_the_layout_does_not_narrow_keeps_the_map_s_words_shown`,
for a status beside the map, an aside after the body (both a column with
the open outline) and a narrow sidebar a page sets (the disclosure). The
last two failed on an earlier version of this branch, which narrowed a
trailing aside and picked the map's form by the track's width.
- `test_a_route_taller_than_the_map_returns_to_an_open_outline` now
checks that the resting outline lays nothing over the title, instead of
fitting a column's gutter.
- Deleted `test_a_status_line_in_the_map_s_track_follows_the_map`: a
status beside the map now keeps the sidebar a column, which the new test
covers.
- The history, crowded-map, marks and go-to tests reveal the map before
pressing or hovering a label.

</details>

Refs #5619

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

A contents map in margin form still reserves the whole sidebar width

1 participant