Repository navigation
Stack a sidebar's aside over its body, so the revealed contents map covers it - #5117
Merged
Merged
Conversation
…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.
leaf-agent
approved these changes
Nov 3, 2026
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.  **After**: the same map in its own track. Nothing covers the prose, and the column starts where it did.  **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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The margin contents map (
lf-tocin 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 ownz-index: 4ranks 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: 1and the bodyisolation: isolate(browser/layouts.css), so whatever the aside lays over the body covers everything the body paints, including boxes the page lifts with its ownz-index. A flex item takes az-indexwithout being positioned, so the aside needs noposition.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, aspage-layout.mdalready directs.Evidence: hovering the map on
docs/event-log.htmlat 1440×900 and hit-testing its surface found code lines, table cells, anlf-diagramandlf-optionrows on top in the base, in Chromium and Firefox; with this change, nothing.leaf-dev stillsover 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 testtest_the_revealed_margin_map_covers_every_box_the_body_paintsfails on the base for a table, page-drawn bullets and a box with its ownz-index. Thesidebar-contentsfixture gains a table under the revealed map, so thecontents-over-readingstills cover a positioned box.Still uncovered: Leaf's own block controls, such as a heading's Copy link, live outside
mainand stay over the map by the stacking ladder's design (base.css); that needs its own change.