Skip to content

Let a page module say where the margin's rail stands - #6121

Closed
max-sixty wants to merge 11 commits into
mainfrom
margin-as-widget
Closed

max-sixty wants to merge 11 commits into
mainfrom
margin-as-widget

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

A page whose layout keeps its margin somewhere other than right of the column can now say where. placeMarginRail(place) registers a function that Leaf asks for {edge, side} or null, given the column's prose box, the shell's edges and the rail's width and hang. Leaf's own rail is now one such placement. Every rule about a single row (rail or pin, packing, a pin's seat) stays in core and reads the rail's side where it read the column's right.

What the diff doesn't show:

  • A page that registers nothing draws as before. Of 37 catalogue states that draw the margin, a card or the resting comment box, 34 are identical to main's in pixels and computed styles, and the other three differ as often between two runs of one commit.
  • Only the markers follow the rail. With a left rail on a centred column, a thread's card and the comment box still open right of the text, across the column from their marker; the comment box no longer rests beside the block the user is on (c opens it); and a marker's preview opens over the column's words. On a page whose only room is on the left, the card and the resting box do stand on the rail's side. The room data-rail="right" gives up and the window width at which a thread opens as a card also still assume the right.
  • Leaf doesn't read the room a placement names. Its entries stand over whatever the page puts there, apart from Leaf's own layout-note asides, and it doesn't check that the room is wide enough. The reference says both.
  • One guard from the trial is gone. The trial re-read every row whenever the rail's answer moved. A resize, a page mutation and layoutChanged already do that, so the reference asks a module that moves its own strip to call layoutChanged, and the browser test moves its strip by a change Leaf doesn't hear.

To try it, press Move the rail in the feature gallery's Margin entries scenario.

max-sixty chose this on a decision page, over keeping the rail fixed (my advice) and over a side named in data-rail. A fresh reviewer's two passes are folded in.

Tests: the runtime's unit tests, the type check, the gallery's page check, render gate and axe sweep, and the 65 margin and commenting browser tests that hold this code.

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

Scratch trial measuring what it takes to move where margin rows stand out of
core. A page or package names the rail with `placeMarginRail(place)`, where
`place({column, shell})` returns `{edge, side}` or null; by default the rail
hangs `--lf-rail-hang` right of the column, as before. Core keeps every
per-row rule (posture, packing, pins, records) and reads them against the
rail's side instead of the column's right: a block's reach into the rail, the
notes beside it, the step back inside the shell, a bounded region's frame, the
first row's rest spot, and the resting comment box.

A pass drops its seating records when the rail's answer moves, since a
placement can read boxes the pass's observers don't watch.
leaf-agent
leaf-agent previously approved these changes Nov 16, 2026
leaf-agent
leaf-agent previously approved these changes Nov 16, 2026
#6237 removed the margin's note rows, so the rail no longer reads notes on
its side: rowPlacement drops `noted`, the layout pass its notes reading, and
module-annotations.md its mention of layout-note asides.
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026
Since #6224 a page's own button takes Leaf's face by element, and stamping
refuses one that writes the runtime's lf-btn class, which failed the site
build on the feature gallery.
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026
@max-sixty

Copy link
Copy Markdown
Owner Author

Closing: max-sixty chose to keep the rail as main has it. This adds a public name for placing the rail while Leaf's own rail stays in core, and the longer-term direction, #6314, has a widget outside core present margin items in any design, which would make placeMarginRail unnecessary.

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.

2 participants