Repository navigation
Decide what stands in a column page's margin with one measurement, and render where it changes - #1297
Merged
Merged
Conversation
…d render where it changes The rail, the contents map, the first sidebar and the sidenotes each moved into the margin at their own threshold: the rail by script, the others by container queries at 848, 1296 and 1536px that copied tokens and assumed the default column. `settleResidency` (margin-layout.js) now reads the room beside `main` once a frame, admits the rail, then the sidebar (or, with a fine pointer, the contents map's spine), then the notes, and writes `data-lf-margin` and `--lf-shift` on `main`; the column Layout moves over by the shift and the stylesheet keys every posture on the tokens. The render gate sweeps to 1920px, finds each width where `data-lf-margin` changes and renders the page there. The comment bar's lane above or below a passage starts from the compact control's minimum rather than its first measured width, which a restored draft widened. Behaviour the tests pin moved: residents' thresholds are derived from the tokens, a note hangs from 1152px with the column moved left, one more read of `main` per refresh, and the render order includes the margin widths. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/layouts.css # skills/leaf/assets/theme.css
…and render only where the page's own residents change Review follow-ups to the residency pass: a sidebar holding only the contents map stands as the map rather than floating an empty box and moving the column; --map, --sidebar and --note are registered lengths so a page may restate them in any unit; the pass reads the offset the column stands at rather than the one it wrote; a resident inside a box the page does not show needs no room; and the render gate leaves the rail out of the widths it renders at, since the rail holds only Leaf's markers. Tests that moved: the left-sidebar test's sidebar holds a line beside the map so it still floats, and a map-only copy checks it takes no room; the contents-map test expects a map-only sidebar not to float; the gate finds two margin widths on a sidebar and note page; the note-strip test opens the view its note is in; SPILLING_PAGE is 65vw, which the sweep to 1920px no longer finds scrolling the page. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… prettier hook Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Sep 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A hidden sidenote still moves the reading column. In settleResidency, the parent visibility check counts a note inside a closed <details>: the <details> itself is visible, while its note is not. I reproduced this at 1200px; main was marked rail note and shifted -168px with the disclosure closed. Residency needs to follow whether the resident can render, and opening or closing that disclosure needs to request a new residency reading. Otherwise a page changes its column position for content the user cannot see.
…w hides A sidenote inside a closed <details> still moved the column, because the pass asked whether the note's parent rendered and the <details> does. The pass now asks whether the resident itself renders, keeping one the page hides itself (the feature gallery hides its sidebar until it stands in the margin), and a toggle anywhere asks for a new reading. New test: a note in a disclosure takes no room while closed and hangs once opened. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 27, 2026
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.
One measurement now decides what stands in a column page's margin: the rail, the contents map, the first sidebar and the sidenotes. The column moves off centre where a sidebar or note needs the room, and the render gate renders each page at the widths where its margin content changes.
Before, each resident moved into the margin at its own threshold:
The sidebar and note thresholds were pixel copies of tokens that assumed the default column, so a page that widened its column got a sidebar positioned off the window's edge. The gate reads at 1200px, so it never saw a sidebar or note in the margin.
Now,
settleResidency(margin-layout.js) reads the room besidemainonce a frame and writes the answer onmain:data-lf-marginholds one token per posture standing:rail,map,sidebarornote;--lf-shiftholds the column's offset, which the column Layout applies as a relative offset (layouts.css).It admits residents in order:
--rail. It never moves the column.--sidebar. With a fine pointer, a sidebar holding the contents map stands as the map's spine (--map, 48px) where a full sidebar does not fit. It does the same where the map is all it holds, since a float would hold nothing. A map-only sidebar left in the flow takes no room there (Take no room for a sidebar the contents map has left, and drop the retired column variables #1273's rule, now keyed on themaptoken).--note.Each element declares its postures in CSS (
--lf-resident), so the media and Layout conditions stay in the stylesheet. The widths the script reads are registered lengths, so a page may restate them in any unit. A resident that a closed disclosure or an unchosen view hides takes no room, and a toggle asks for a new reading. One the page hides itself stays a resident, so a page can show it only once it stands in the margin. The stylesheet keys every posture on the tokens instead of@container lf-shellqueries, and chrome-layout'ssyncLayoutasks for the reading.With the default column (768px box), a sidebar reaches the margin from 1130px and a note from 1152px. A sidebar and a note together need 1416px. The column moves over by what one side lacks, so at 1200px a note page's text sits 168px left of centre. A page that changes its column's width gets thresholds that follow it.
First paint. Residency is now decided by script, so a page whose residents stand in the margin paints with them in the flow and moves them on the first rendering frame. That is the trade chosen when measuring won over fixed widths ("layout waits one frame for script"). The bootstrap can't take the reading earlier: it is a classic script, and its first frame can come before the residents are parsed.
Page CSS can follow the margin by keying on the tokens. The feature gallery's copied 1151px width became
main:not([data-lf-margin~="map"], [data-lf-margin~="sidebar"]) #bg-sidebar. page-authoring.md documents the tokens, and the registry's sidebar and sidenote descriptions say when each stands.Render gate. The sweep now runs from 360 to 1920px and records the page's own residents at each width, without the rail, which holds only Leaf's markers. For each step where they change, the gate halves the step to the exact width and renders the page there in the light scheme. That is where each resident has the least room it will ever have.
version check --rendernames those widths when it passes. The sidenote-in-a-clipping-box test that was strict xfail now passes, and the static test that compared the gate's 1200px to the theme's container floors is deleted.Comment bar. Above or below a passage, the bar's lane started at its first measured width, which a restored draft's words widen. A reloaded draft opened 292px further left than the same draft typed fresh. The start is now the compact control's minimum, so one draft opens in one lane.
The corpus is unchanged. It still sets each example's body in one column page. Every example already gets the full gate, sweep included, in its own Layout through the nightly
test_page_fixture_renders. A multi-Layout corpus would need the wide and workspace Layouts to work belowmain. TODO.md now says exactly this.Behaviour the tests pin moved:
test_margin_residents_stand_where_the_room_beside_the_column_holds_themderives each threshold from the tokens and checks one pixel either side.test_a_note_hangs_in_the_margin_where_the_room_holds_it: at 1190px the note now hangs, with the column moved left.test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back: its sidebar holds a line beside the map, so it still floats. A map-only copy checks that sidebar takes no room at 1100 and 1400px.test_unchanged_margin_refresh_cost_is_bounded_by_refresh_countallows one more read ofmainper refresh, for the residency reading.test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edgeremoves the gallery's note, which would otherwise move the column at the width the case was picked for.test_the_render_gate_exercises_both_schemes_at_both_viewportsexpects the margin renders after the four fixed ones.test_a_note_the_page_does_not_show_takes_no_room,test_the_render_gate_renders_where_the_margin_content_changesandtest_a_draft_below_its_passage_keeps_its_lane_whatever_it_holds(bug-back checked).Still open, in TODO.md:
data-rail="right"reserves the rail at every width, so a phone keeps a 295px column.🤖 Generated with Claude Code