Repository navigation
Start a track's status line clear of the contents map's spine - #5309
Merged
Merged
Conversation
`page-authoring.md` and `page-layout.md` tell an author to keep a short status or verdict in the sidebar track beside `lf-toc`. On a document page (a `layout-column` body) under a mouse, the contents become the margin map: a fixed spine down the track's start edge that reserves no room, so a status paragraph in the same track started on the spine, with the line through its first letters. The strip that opens the map's labels also lay over those letters, so pressing or selecting them opened the map instead. In that form, the track's other blocks now start past the map's resting box (`--sp-4`, 24px), clear of the spine and of that strip. The rule lives in `toc.css` beside the map's own, under the same conditions, so a track that wraps above the body, a touch screen and a track with no contents keep their layout. A track holding only the contents has nothing for it to move. Measured on a copy of the page that prompted this, in Chromium and Firefox: the status's text started at the spine's x (32px) and now starts 24px past it, and a press on its first letter reaches the paragraph rather than the map's strip. A new test in `test_contents_and_glosses.py` checks that press and fails without the rule. A route too long for the map still covers the status: the map becomes an open outline on opaque paper across the whole track.
leaf-agent
previously approved these changes
Nov 4, 2026
`test_layout_style_and_widgets_never_read_each_other` refuses a package
stylesheet that names a Layout class, and the first version read
`.layout-track`. The class was there only to keep the selector cheap:
without it, `:has(> lf-toc) > :not(lf-toc)` grows with the square of a
long column in Chromium, which reads the parent's children again for
each child. With a forced restyle of one box holding 1,000 and 4,000
paragraphs, it took 381 and 3,540 ms against 48 and 364 ms with no rule.
`@scope (:has(> lf-toc)) { :scope > :not(lf-toc) }` names no Layout and
stays linear: 254 ms at 4,000 in Chromium against 268 with no rule, and
32 ms at 16,000 in Firefox against 54. A status line still starts at
56px beside the spine at 32px in both engines, and the press test passes.
Each comparison came from one run on a loaded host.
leaf-agent
approved these changes
Nov 4, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…onger restyles the whole page (#5363) #5309 moved a track's status line clear of the contents map's spine with `@scope (:has(> lf-toc)) { :scope > :not(lf-toc) { … } }`. In Chromium, a `:has()` that is its compound's only selector, standing as a scope's root or leading to a subject that names no element, makes any write to an element's text, or to an attribute another `:has()` reads, restyle the whole document. The rule cost that on every page, including pages it never matches. On the `asks` page of `leaf-dev scaling` at 64 sections, a Tab that showed six key badges ran 16 style recalcs, each restyling the whole page: 938 ms of recalc in a trace, against 26 ms at #5309's parent. Most of those recalcs are forced by the key badge loop in `command-hints.js`, which measures each badge right after writing it. The scope's root is now `div:has(> lf-toc)`, the track's element in page-layout.md, page-authoring.md and every example. Behavior change: a track written as another element, such as `<section class="layout-track">`, leaves its status line on the spine again. `lf-toc ~ :not(lf-toc)` places the status the same way in every case the references and #5309's test describe, with no `:has()`, but Chromium matches it by reading each child's earlier siblings: a full restyle of a 4,000-paragraph column took 30 ms against 2.5 ms for the typed scope, and 438 ms against 10 ms at 16,000. `test_an_untyped_has_leads_only_to_a_typed_subject` refuses the shape in every shipped stylesheet. A `:has()` that is its compound's only selector, with no compound naming an element before it, may not be an `@scope` root, and may lead only to a subject that names a type, class, id or attribute. It flags nothing else in the shipped CSS today. With the old rule restored it names toc.css, and it names each shape a Chromium trace showed restyling the whole document (`:has() > :not(.y)`, `:is(:has()) > *`, `:not(:has()) :first-child`, `:has() ~ *`) while passing those that stayed local (`:has() > pre`, `.a :has() > *`, `div:has() > *`, `@scope (div) to (:has())`). Main-thread CPU on the `asks` page, two rounds interleaved against main 9164433 (Tab: median of six Tabs from load; click: median of four clicks on an option): | | main | this | |---|---|---| | Tab, 64 sections | 395 / 678 ms | 70 / 57 ms | | Tab, 512 sections | 4.61 / 3.60 s | 517 / 281 ms | | Click, 64 sections | 291 / 438 ms | 73 / 67 ms | | Click, 512 sections | 3.39 / 1.56 s | 517 / 284 ms | > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…ne layout for its faces (#5366) `paint` in command-hints.js lent each route's face, read it, then wore or withheld it before moving to the next route, so each face it lent forced two style recalcs and a layout. #5309 showed what that costs: under a rule that widened every restyle to the whole page, a Tab that lent six faces spent 715 ms in the loop's 11 recalcs (root AGENTS.md, "Responsiveness"). The faces now go in passes over every route: which controls the window shows, then each face lent, then each face read as it stands, then each worn or withheld. The chips read where each goes before writing any digit, and the badge placement writes each chip's visibility once every chip is placed; a chip takes no presses, so none was in the stack another chip's place reads. With every face lent before any is read, a face lent in the same pass no longer counts as covering another. `reserve` already gives two faces whose boxes overlap to the earlier route. Before, whether one face covered another depended on paint order: an earlier route's face always did, and a later one only while still lent from the previous paint, so two faces over each other could both be withheld. None of the pages compared below shows a case where the two orders differ. Every face's digit, worn state, opacity, display and box, and every command chip's digit, visibility and box, matched main after each of 15 inputs (Tabs, Shift+Tab, `m` and `t` walks, option focus) on the `asks` page of `leaf-dev scaling` at 8 and 64 sections, alert-review, release-notes, heat-loss, and the developer deck, feature gallery and playground (`leaf-dev probe --base`, reduced motion; 527 face and 24 chip readings). A hit test names a shadow tree's host for whatever that tree holds, so a host over a face is now read again inside its tree: it covers the face unless all its tree holds there is faces lent in the same pass. Without that, a later route's face in a shadow tree, lent before the earlier face was read, covered it through its host and took the slot `reserve` gives the earlier route (`an earlier route keeps its face under a later route's face in another shadow tree`, a runtime test). On the `asks` page at 64 sections, a Tab that lends six faces ran 18 style recalcs and 7 layouts on main, 11 and 6 of them forced by the hint loop; it now runs 8 and 2, 1 and 1 of them the loop's. A Tab that lends none is unchanged. Main-thread CPU, two rounds interleaved against main 9328f61, moved within the host's noise now that #5363 keeps each recalc local (Tab: median of six Tabs from load; click: median of four): | | main | this | |---|---|---| | Tab, 64 sections | 43 / 42 ms | 43 / 33 ms | | The Tab lending six faces, 64 sections | 51 / 50 ms | 40 / 34 ms | | Tab, 512 sections | 272 / 160 ms | 220 / 224 ms | | Click, 64 sections | 60 / 54 ms | 53 / 51 ms | | Click, 512 sections | 302 / 210 ms | 243 / 259 ms | Tests: `pnpm run test:runtime` (782 passed), `pnpm run check:browser`, and the 29 browser tests that read binding faces or chips, in test_command_routes, test_card_placement, test_clusters, test_pins, test_obligation_walk, test_render_options, test_render_options_addition, test_render_widgets and test_obligations (33 cases passed). > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…hrome no longer restyles the page (#5370) On the 512-section asks page of `leaf-dev scaling`, most of a wheel step's main thread went to restyling the page. Each heading that scrolled under the pointer showed its link, the link moved into the chrome, and Chromium restyled 20,255 of the page's 28,335 elements. The rule behind it is toc.css's `@scope (div:has(> lf-toc))` from #5363. Chromium tests a scope root's `:has()` on every element the rest of its compound matches, here every `div`, the chrome's among them, and adding or removing a node inside any of them restyled the page. Bisecting the shipped sheets rule by rule found that rule alone. The block after the map now clears the spine by `lf-toc + *`, which asks only for the element just before each one. Behavior change: a second loose block in the track stands by the spine; page-layout.md's sidebar holds the map and one block, page-authoring.md asks for a short status, and a page with several blocks wraps them in one element, which page-layout.md, "A sidebar page", now states. Each wider form costs pages with no map as well: `lf-toc ~ :not(lf-toc)` reads every earlier sibling for each element tested, and a full restyle of a column of 4,000 paragraphs took 82 ms against 54 ms with no rule, and 55 ms with `lf-toc + *`. Naming the track's class in the scope would have the default package read a Layout (`test_layout_style_and_widgets_never_read_each_other`). annotation-chrome.css's `html:has(.lf-margin-preview leaf-text:focus-within, …)` goes too. Chromium matched its argument against the document again at each write in the chrome, which took about 5 ms of style recalc instead of 1 ms. floating.js now writes `data-lf-floating-editor` on the root while the user is in a `leaf-text` inside a box it stands in a plane, read as the user moves and as a box takes or leaves its plane, and the root's scroll padding drops on it as before. Checked in the response bar and in a thread's card: set while the user writes, cleared when focus moves to the card's Close and on Escape. `test_an_untyped_has_leads_only_to_a_typed_subject` now also refuses an `@scope` root whose `:has()` names its element by a type alone. With the old rule put back it names toc.css. Against main 9328f61 on the 512-section asks page, interleaved, a fresh tab each: | | main | this | |---|---|---| | A node added to the chrome and removed: style recalc, largest restyle | 182.6 ms, 20,199 elements | 1.5 ms, 27 elements | | A heading hover: style recalc, largest restyle | 93.7 ms, 20,255 elements | 2.0 ms, 58 elements | | A `leaf-dev scaling` wheel step, pointer at 400, 400: main thread, style recalc | 60.7 ms, 28.3 ms | 33.4 ms, 1.9 ms | Medians of 3 rounds for the first two rows and 5 for the wheel step. Style recalc was 47% of the step and is now 6%. #5309's `test_a_status_line_in_the_map_s_track_stands_clear_of_its_spine` passes, and fails with the rule removed. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: leaf-agent <[email protected]>
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.
page-authoring.mdandpage-layout.mdtell an author to keep a short status or verdict in the sidebar track besidelf-toc. On a document page (alayout-columnbody) under a mouse, the contents become the margin map: a fixed spine down the track's start edge that reserves no room. A status paragraph in the same track therefore started on the spine, with the line through its first letters. The strip that opens the map's labels also lay over those letters, so pressing or selecting them opened the map instead.In that form, the contents' siblings now start past the map's resting box (
--sp-4, 24px), clear of the spine and of that strip. The rule lives intoc.cssbeside the map's own rules, under the same conditions, so a track that wraps above the body, a touch screen and a track with no contents keep their layout. A track holding only the contents has nothing for the rule to move.The rule finds the siblings with
@scope (:has(> lf-toc)) { :scope > :not(lf-toc) }. A package may not name the track's Layout class (test_layout_style_and_widgets_never_read_each_other), and the plain:has(> lf-toc) > :not(lf-toc)grows with the square of a long column in Chromium, which reads the parent's children again for each child. With a forced restyle of one box holding 4,000 paragraphs, that selector took 3,540 ms against 364 ms with no rule. The scope took 254 ms against 268 in Chromium, and 32 ms against 54 at 16,000 in Firefox. Each comparison came from one run on a loaded host.Measured on a copy of the page that prompted this, in Chromium and Firefox: the status's text started at the spine's x (32px) and now starts 24px past it, and a press on its first letter reaches the paragraph rather than the map's strip. A new test in
test_contents_and_glosses.pychecks that press and fails without the rule.The revealed labels start 14px from the spine, so a 14px gap would align the status with them, but it would leave its first letters on the strip, which reaches 16px.
A route too long for the map still covers the status: the map becomes an open outline on opaque paper across the whole track.