Skip to content

Stack a sidebar's aside over its body, so the revealed contents map covers it - #5117

Merged
max-sixty merged 2 commits into
mainfrom
toc-cover-lists
Nov 3, 2026
Merged

max-sixty merged 2 commits into
mainfrom
toc-cover-lists

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The margin contents map (lf-toc in a sidebar's margin track) washed over the body's prose when revealed, but tables, code blocks, diagrams, option rows and any other positioned box in the body painted over it at full ink. The map's own z-index: 4 ranks it only inside the track, whose sticky box is a stacking context, and the body's positioned boxes come later in the tree, so they painted over the whole track.

The sidebar Layout now gives the aside z-index: 1 and the body isolation: isolate (browser/layouts.css), so whatever the aside lays over the body covers everything the body paints, including boxes the page lifts with its own z-index. A flex item takes a z-index without being positioned, so the aside needs no position.

Behavior change: a box in a sidebar page's body, even a fixed one with a high z-index, now paints beneath the aside where the two overlap. A page's own modal or menu still rises over it through the top layer, as page-layout.md already directs.

Evidence: hovering the map on docs/event-log.html at 1440×900 and hit-testing its surface found code lines, table cells, an lf-diagram and lf-option rows on top in the base, in Chromium and Firefox; with this change, nothing. leaf-dev stills over the sidebar states (contents map, PR walkthrough, triage board, live progress, command hub) shows the intended change under the revealed map and otherwise only antialiasing noise on one diagram's curves. The new test test_the_revealed_margin_map_covers_every_box_the_body_paints fails on the base for a table, page-drawn bullets and a box with its own z-index. The sidebar-contents fixture gains a table under the revealed map, so the contents-over-reading stills cover a positioned box.

Still uncovered: Leaf's own block controls, such as a heading's Copy link, live outside main and stay over the map by the stacking ladder's design (base.css); that needs its own change.

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

…overs it

The margin contents map (lf-toc in a sidebar's margin track) washed over the
body's prose when revealed, but tables, code blocks, diagrams, option rows
and any other positioned box in the body painted over it at full ink. The
map's own z-index ranks it only inside the track, whose sticky box is a
stacking context, and the body's positioned boxes come later in the tree, so
they painted over the whole track.

The sidebar Layout now gives the aside a z-index and makes the body one
stacking context, so whatever the aside lays over the body covers everything
the body paints, including boxes the page lifts with its own z-index.
Behavior change: a box in a sidebar page's body, even a fixed one with a high
z-index, now paints beneath the aside where the two overlap; a page's own
modal or menu still rises over it through the top layer (page-layout.md).

The sidebar-contents fixture gains a table under the revealed map, so the
contents-over-reading stills cover a positioned box.
@max-sixty
max-sixty merged commit d1403bb into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the toc-cover-lists branch November 3, 2026 05:13
leaf-agent added a commit that referenced this pull request Nov 7, 2026
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 added a commit that referenced this pull request Nov 7, 2026
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)](#5619 (comment)).

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


![Before](https://github.com/user-attachments/assets/6f8dfbe7-3976-42e1-892e-35afa111b033)

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


![After](https://github.com/user-attachments/assets/1539b02b-af76-4a06-8a51-842ff6dac939)

**Removed**
- `layouts.css`: the aside's `z-index` and the body's `isolation`, which
existed only so the revealed labels covered the body (#5117).
- `toc.css`: the reveal machinery (`:hover` / `[data-lf-focus-within]` /
go-to widening, the press strip on the spine, `pointer-events` toggling,
the label fade) and the `lf-toc + :not(.lf-ui)` clearance rule with its
restyle-cost notes (#5309, #5363, #5370).
- Render checks: `restsOverPage`, the resting-overlay exemption from the
width floor and from the margin readings (#3109).

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

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

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

</details>

Closes #5619

---------

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