Skip to content

Stand margin rows in a declared rail or as filled pins, and let o hide them - #1164

Merged
max-sixty merged 39 commits into
mainfrom
rail-pins-plan
Sep 25, 2026
Merged

max-sixty merged 39 commits into
mainfrom
rail-pins-plan

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Every margin row now stands in one of two places, and nothing Leaf draws moves the page's content. On a column page with room, a row stands in the rail beside the column. Everywhere else, a row stands as a pin inside the top-right corner of the block it is about. A new o key hides every pin and passage mark so the user can see what they cover.

Before this, a column page narrower than 863px hid its markers behind the Map door, and suggestion controls docked into the text and re-wrapped it. A sheet's marker stood in a rail two columns away from its card.

Placement (margin-layout.js, margin-placement.js)

  • Rows are positioned with CSS anchor positioning in a zero-height layer in .lf-chrome. The page scrolls them on the compositor, with no layout pass.
  • Each pane that scrolls on its own gets a lane, clipped to what the pane shows. A row also follows its target through a scroller inside a shadow tree.
  • A row is withheld (hidden and out of the tab order) when its target is clipped away, above its scroller's view, or, for a pin, past the scroller's right edge.
  • A row whose anchor the browser refuses is also withheld. The render gate reports it (strandedMargins).
  • A pin never covers a control of its own block, such as a card's drag grip; it moves below it.
  • On a column page, a comment on a figure wider than the rail becomes a pin on the figure.

The rail is declared. Column pages get a rail and sheets and workspaces pin. data-rail="right|none" on main overrides either way, and validation refuses data-rail anywhere but main.

The pin's look, picked from stills on a review page:

  • a filled teardrop in a saturated blue (--pin-fill) with a paper edge;
  • 26px with a mouse and 44px under a finger.

A rail marker shows its thread's state in the colour of its paper face. A pin shows it on its other parts:

  • the user's turn rings the pin;
  • agent pickup turns its edge green;
  • working turns its fill green;
  • a read-only status keeps the paper face.

The o key hides every pin and passage mark. The rail stays, since it covers nothing. The state lives in the tab store. Asking for something by name (t, a, Threads, the Page Map) still shows it.

Contributed controls, such as a suggestion's ✓/✗, live in the margin layer, after the page's content in the tab order. Alt-click on a pin reaches its target.

Render gate

  • strandedMargins is a fault: a marker with nowhere to stand.
  • coveringMargins is advice: it names each pin that stands over lines of text.

Docs. page-authoring.md gains "The rail and the margin"; packages.md, assets/AGENTS.md and the glossary are updated. The plan note is deleted, now that its contract lives in the code and the references.

Tests. They were rewritten where they asserted docking or the Map door. New browser cases cover:

  • the rail declaration;
  • o;
  • pins in panes and behind inactive tabs;
  • tab order;
  • a stranded marker;
  • the gate advice;
  • the gallery's wide figure.

tests/runtime/margin-placement.test.mjs covers the posture and packing folds.

Checks. The full nightly suite, run locally on the merged tree, passes 3163 tests. The one failure, test_the_adopted_sheet_decides_nothing_by_standing_last, also fails on main: the corpus's sort film changes its reading.

🤖 Generated with Claude Code

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

max-sixty and others added 30 commits September 24, 2026 15:28
The Asks tray and the thread panel no longer take room from the page. The
tray used to take a strip on the left of every page, and the panel took one
on the right of a sheet. Both strips were a transparent body border. Now
both surfaces stand over the page like the Leaves tray, so the page's
geometry is the author's whatever the user opens. Each still covers the page
(modal, page inert) only where it would leave less than a usable 320px.

Removed with the strip: the bootstrap's pre-paint restore of the surface and
its width, `takeShell`/`moveContentFrame`, `--lf-shell-inset-left`, and
`data-lf-sizing`.

Threads now slides in from the right and out again, like the trays, through
one `slide()` in motion.js. A reopen during the exit reverses from where the
surface is. The slide's end is announced (`lf-slide-end`), and read
acknowledgement rescans on it, because the only earlier scan saw the panel
off screen. Layout and composer placement read the panel's settled
`offsetLeft` rather than a mid-slide box.

Both trays are declared occluders, so travel, exposure, and placement treat
what a tray covers as hidden. Pressing an Ask's row clears a tray that stands
over most of that Ask.

Behavior the tests moved: tests that held the strip, its scroll anchoring,
its single-pass shell change, and margin postures narrowed by the tray are
deleted. One parametrized test now holds that neither surface moves the page
(column, sheet rail, scroll height). The restore test holds first-paint
geometry equal to presented geometry. A new test covers the occluder
clearing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	tests/test_render_pages.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Research and implementation plan for the optional rail plus pin overlay
from notes/layout-approach.md (branch how-it-works-one-layout): pins
replace docking, anchor positioning ties every marker to its target from
the chrome, the rail is declared on main with defaults by page form, and
`o` hides the annotation layer. Browser claims were probed in Chrome 153.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Three places where something Leaf draws changed the page's geometry at
run time, each replaced so the page is what its HTML and CSS say:

- A margin row level with a wide block now steps out past the block
  into the rail, instead of the block giving up its right-hand growth
  (`data-lf-yield`). The block's growth already stops at main's gutter,
  which holds the rail's reservation, so the room past it is the
  rail's. A comment arriving beside a board no longer narrows it.
- The shortcut line is now the bottom band: one row across the
  window's foot at a stated height (`--lf-band-h`, 44px plus the safe
  area), the banner's counterpart. The page, a held workspace, the
  trays' lists and the contents map all end above that constant, so
  `--lf-bottom-chrome-clear` and its per-layout measurement are gone.
  The status sits at the band's far end instead of stacking above the
  line; a wrapped line (a `g` sequence, the `?` shelf) grows upward as
  an overlay. A touch screen draws no band, and a standing status there
  overlays the page. This settles the TODO on `lf-toc`'s rule: the map
  now ends above the band.
- Opening a surface in a contained specimen no longer sets a 32rem
  minimum height on its body, which grew the containing page.

The shorter contents map exposed a latent hit-testing bug: a row's span
stood over the previous row's link when rows were dense, so one link
lost its Go-to hint. Rows now take no presses; the link is the only
thing in the map to press.

Tests that asserted the old geometry now assert the new one: rows step
past a board that keeps both margins, the band's reservation equals its
height, the status is centred in the band's row, and the map ends at the
band's top. The phone Tab-to-field case uses a 600px window, since
Chrome's focus scroll moves only a stop wholly outside the padded band.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The nightly selection found three effects of the overlay change.

- A tray sliding out is marked `data-lf-leaving`. While it is marked, it
  takes no press and no occluder reading counts it. A reopen during the
  exit reverses from where the tray is.
- Threads slides in and closes at once. Delaying `panel.close()` for a
  slide-out left the dialog visible to the thread list, the walks and
  placement. A `t` pressed during the exit then focused a card in the
  closing panel.
- Tests that measured the panel mid-slide (`card_body`) now read it
  settled. Tests that relied on a tray narrowing the shell (margin
  postures, the ToC inset, an equal-width surface swap) now hold that the
  tray changes nothing underneath, or are deleted where the subject no
  longer exists. The monitoring test now expects the trip to clear the
  panel standing over its region.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Wide figures take a pin; column pages have a rail and every other page pins,
declared with data-rail on main; no sidenote inference.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/theme.css
#	tests/render_cases_layout.py
#	tests/test_render_gate.py
# Conflicts:
#	tests/render_cases_navigation.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
o hides everything drawn over the page, pinned controls included, and keeps
the rail.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On a touch screen and in a contained specimen the band's height is
zero, so centring the status on it put half the chip below the window
(the Ask position at 390x844 spanned y=828.5-859.5). Where no band is
drawn, the status stands on its own 14px inset instead. The touch test
now checks the chip's visible bounds, not only its height.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#1145 replaced RENDERED with rendered(page); the band's new check in the
g-chord test still called the old name.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s-plan

# Conflicts:
#	skills/leaf/assets/runtime/chrome-layout.js
#	skills/leaf/assets/runtime/trays.js
Every margin row now lives in the chrome's margin layer and stands by
its target through CSS anchor positioning, so Leaf inserts nothing into
the page's content and nothing it draws moves that content.

- Rail or pin (margin-placement.js, margin-layout.js). A column page
  keeps its rail; a sheet, a narrow shell, and a pane that scrolls on
  its own stand rows as pins at their block's top-right, beside it
  where the page leaves room. A row whose figure grows past the rail
  stands on the figure. Rows are position: fixed, so any element is a
  valid anchor, the browser moves them with every scroll between them
  and their target, and none can widen the page. Each bounded pane gets
  a lane clipped to what it shows. Docking, external hosts, the rail
  reservation attribute and measureMargin are gone.
- data-rail="right|none" on main overrides the default by page form;
  version check takes it only on main.
- o hides the annotation layer (annotation-layer.js): pins, passage
  marks and their contours go, the rail stays, no box moves, a hidden
  passage opens nothing, and the tab keeps the choice. The row of the
  target the user stands at stays visible.
- An aimed press on a margin row aims at the element it stands by,
  since the rows are chrome and the aim otherwise let the press
  through.

A temporary look switch (data-lf-look-* on the root) carries the look
pass's alternates; it goes before landing.

Tests that asserted docking and the stepped rail now assert the rail
and pin postures; suggestion controls follow the page's content in the
tab order.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/AGENTS.md
#	skills/leaf/assets/runtime/chrome-layout.js
#	skills/leaf/assets/runtime/chrome.css
#	skills/leaf/assets/runtime/margin-layout.js
#	skills/leaf/assets/runtime/margin-projection.js
#	skills/leaf/assets/runtime/motion.js
#	skills/leaf/assets/runtime/restore-state.js
#	skills/leaf/assets/runtime/trays.js
#	skills/leaf/assets/theme.css
#	tests/test_render_margin.py
#	tests/test_render_pages.py
#	tests/test_render_widgets.py
Fixed rows kept pins in place under a sideways-scrolled board, but a
fixed row off screen is one no focus or press can scroll to. Absolute
rows with no clamp to the window get both: the browser moves the pin
with its scrolled target, and html's overflow-x keeps the page from
scrolling sideways. The rule hiding projected marks under o moves inside
the chrome's scope, where its private classes live.

Tests that read margin controls inside main, or a row withheld at 820px,
now read the layer and the pin.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The margin section gains a schedule wider than the column with an agent
thread on it: its marker stands on the schedule as a pin while the prose
keeps the rail, and o hides the pin. The corpus is regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/margin-projection.js
…arkers

Review fixes to the margin layer:

- A row withheld on its first pass is anchored all the same, so it stands
  on its target once a scroll brings the target in. One capture scroll
  listener re-reads the rows under whatever scrolled, a table or board as
  well as a pane, and brings the full pass when one changes answer.
- A lane's clip is its region's own band cut by the scrollers around it,
  not by the window, and a resize of the region brings the pass again.
- A pin whose line has scrolled above its pane's top is withheld rather
  than clipped and still focusable.
- reach() stops at a scroller: a cell far along a wide table is not a
  figure grown past the rail.
- A row the browser will not anchor (its element behind anchor-scope, say)
  is withheld and marked, and the render gate reports it
  (strandedMargins). Pins standing over text are advice
  (coveringMargins).
- A hovered pin's lane rises to the raised stacking level, and lanes run
  in row order.
- Under o, only an explicit arrival (the Ask walk, focusForNavigation)
  shows a hidden row; Tabbing onto a target does not, and hiding the layer
  no longer re-shows the pin the user stood on.
- The author's anchor name is read before any write.

Comments and guidance that still spoke of docking, or of pins that always
unfold leftward, now describe the layer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- A pin never stands on a control of its own block: packing takes the
  block's focusable elements as fixed boxes, so a pin at a card's
  top-right goes below the card's grip instead of taking its drag.
- A pin whose target's right edge is past its scroller's view (a card
  half past a board's edge) is withheld rather than standing beside
  nothing, where it also widened the page's scrollable width.
- The gallery's schedule keeps to a table that fits a phone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/references/page-authoring.md
… pin on its card

theme.css raised a hovered cluster with a rule the runtime sheet states
at the same specificity, so which one applied depended on sheet order.
The moved-change test now reads the pin on its card, where it may be
packed below the card's own marker. The corpus is regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty and others added 7 commits September 24, 2026 22:26
…its line in view

A pin whose line has scrolled above its pane is withheld, so the test
that reads the pin following a pane scroll needs its target's line to
stay in the pane through the scroll it makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A pin now stands inside its block's top-right corner, --pin-inset in from the
right edge, as a filled teardrop in a saturated blue (--pin) with a paper edge:
26px with a mouse, the full aim floor under a finger. The look pass's switch
and the unchosen candidates go with it: the room rule and its frame walk, the
straddle and plain corner pins, the B4 step past a wide figure, and the smaller
touch face. The plan note has landed in page-authoring.md and the code, so it
goes too.

Tests: a pin's right edge is asserted inside its target's right edge rather
than past it, and the one-shape check reads the rail's entries, since a pin's
are smaller by design.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A filled pin had painted over the states a rail marker shows on its paper: a
thread on the user, pickup and read-only status all read as a resting pin. The
user's turn now rings the pin in its own fill, pickup turns its edge green,
working turns the fill green, and a status keeps the rail's paper face. Focus
and selection keep the paper edge. The dark scheme's fills darken so the white
glyph holds 3:1. The rail-or-pin threshold reads a rail-sized entry, since a
pin's are smaller, and the render gate's cover advice explains the corner pin.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	tests/test_render_margin.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A marker for a target inside a scrolling shadow tree stays at the shadow host while the target moves. In a browser reproduction with a 100px shadow scroller, scrolling 20px moved the target 20px but left its marker fixed (its offset from the target changed from 0px to 20px). The scroll reading in margin-layout.js checks whether the host anchor is under the scroller; for a scroller inside the shadow root it is not, and the clip reading also starts at the host. The row can therefore point beside the wrong content or remain available after its target scrolls away. Track the target's inner scroll and visible band when the row must anchor through its host.

A target inside a shadow root anchors through its host and stands at an inset
from it. A scroller inside that tree moved the target and left the row where it
was, since the scroll never leaves the tree and the scroll reading only asked
whether the host was under what scrolled. The layer now hears scrolls on every
shadow tree holding a row's target, a scroll inside the host brings the pass
that takes the inset again, and whether the target is in view is read from the
target up, through the tree's own scrollers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One shadow-scroll visibility case remains; see the inline suggestion.

…roller

The visibility reading cut the host's box by the target's scrollers, and a host
can still overlap a scroller its target has left sideways. A row now stands only
where some rendered part of its target shows through every scroller around it,
as leaf-agent suggested on the PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 097a10f into main Sep 25, 2026
5 checks passed
@max-sixty
max-sixty deleted the rail-pins-plan branch September 25, 2026 08:04
max-sixty added a commit that referenced this pull request Sep 25, 2026
`spreadHints` read each chip's box, worked out where it should stand,
and wrote the shift, all in one loop. It is now three steps: measure
every chip, fold the rectangles through a new pure `seatHints`, then
write each chip's shift. Placement is unchanged; the collision math can
now be tested in Node without a browser.

This is the badge half of the last step of "fewer frame owners": split
the packers into measure, compute and write. #1164 already did the
margin half when it moved row packing into `margin-placement.js`.

- **New test:** `tests/runtime/hint-seating.test.mjs` covers a chip
stacked on another, a chip centred under its target, a chip past the
window's corner, and a chip over the key line on a wide and a narrow
target.
- **Checks:** `npm run test:runtime` (124 passed) and the 46 hint and
target-chooser browser tests in `test_render_navigation.py` and
`test_render_semantic_selection.py`. With the write step's top shift
disabled, 7 of those browser tests fail, so they cover the wiring the
Node tests don't reach.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
…#1171)

Leaf had three page forms an author chose up front: a document in the
reading column, a sheet (`<main data-width="available">`), and a
workspace (a sheet whose only block is an `lf-workspace`, holding the
window). This drops the forms. A page is one stack of blocks, and a
block that needs more room declares it.

**One page kind**
- `lf-workspace` declares `x-space: "available"`. A page whose only
block is a workspace is a wide page with a plain `<main>`, holds the
window as before, and looks identical to one that declares `data-width`.
`workspace_sheet_errors`, which refused that page, is removed.
- Which width a page takes is one reading, `--lf-page-width` on `body`.
`main[data-width]` sets it, the default package sets it for a
workspace-only page, and the wide-page frame (gutter, 1600px cap, title
size) is drawn once from it under a style query. #1164's rail-or-pins
choice reads the same value, so a workspace-only page pins its markers
as a declared wide page does.
- "Sheet" is renamed "wide page" throughout (`--sheet-max` →
`--wide-page-max`). `page-authoring.md` "Composing a page" describes one
kind, then "A wide page" and "A workspace". The guides and workspace
examples write a plain `<main>`.

**lf-grid stacking**
- A template grid stacks where its narrowest track would fall below
`--lf-grid-min` (14rem), the floor auto-fit grids already use, instead
of rounding to a ladder of fixed widths. `1fr 2fr` now stacks below
43.5rem (was 51rem), so it stays side by side in a 900px window beside
the rail.
- `lf-grid.js` measures the grid through the runtime's size observer and
marks `data-lf-grid-stacked`; the theme spans cells on the mark. A grid
in a closed `<details>` is judged while closed. Every template stacks in
print, since no observer runs for print layout.

**Also**
- Scroller and placement advice (`layout_css_advice`) reads stylesheets
the page links from `page/` (`RevisionArtifact.page_stylesheets`), and
names the file in each line.
- The How it works Layout tab is redrawn as SVG drawings whose parts are
`<g id>` groups.
- `notes/layout-approach.md` is retired.
- covered-words continues past an absolutely positioned box from its
positioned containing block, which fixed a false positive on the triage
board. live-progress's checks table sits in two columns to fit its 14rem
rail.

Tests: `uv run pytest tests` 1417 passed, `npm run test:runtime` 112
passed, pre-commit clean. New tests cover exact stacking thresholds,
em-sized and `font: inherit` cells, stacking in print and in a closed
disclosure, a plain-`main` workspace page matching a declared wide one,
and that page claiming no rail. Two independent reviews ran, including
checks on Chrome for Testing 125.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
The margin pin from #1164 now fills with Leaf's ink blue instead of its
own saturated blue. In the light scheme that is the page's accent. In
the dark scheme it is a deeper ink (`#4d74a8`), because that scheme's
accent is too pale for the pin's white icon to read on.

The pin keeps the outline icon. A `TODO.md` entry records when to
revisit that: a filled icon reads more clearly at 26px and needs no
second copy of the SVG, but it fills cleanly only where the icon's
outline is a closed shape.

Both choices were picked on a look-pass review page. The pin, shadow and
colour-scheme browser tests pass locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 26, 2026
…1236)

A comment on one shape of an inline SVG drawing put its pin at the
drawing's right edge, beside a different shape. In the case that
prompted this, a comment on the first of four thumbnails in a wide
figure pinned beside the fourth, and its card opened over that one.

A shape inside an `<svg>` has no CSS box, and Chrome won't anchor to
one: `anchor-name` on a `<g>` or `<rect>` falls back in Chrome 154. So
its margin row anchors through the drawing. The layout pass already
moved the row down to the shape's top with an inset. The pin posture
from #1164 never did the same horizontally, so the pin stood
`--pin-inset` inside the drawing's right edge.

The layout pass now reads the box the target's shown parts cover
together (`shownExtent` in `margin-layout.js`), and the row stands at
that box's top-right corner whatever it anchors through. The pass writes
the corner as two insets from the anchor's box: `--lf-inset-top`
(renamed from `--lf-inset`) and `--lf-inset-right`, which `theme.css`
adds to the pin's `right`. The visibility check clips the same box by
the target's own scrollers, for the top line and the pin's right edge
alike, and packing uses its right edge. The same holds for a target
anchored through a shadow host and for a `display: contents` target,
which anchors through its first part but stands at the corner of all of
them. Whether a row stands in the rail or as a pin is still decided by
how far the whole figure reaches.

Two browser tests pin the behavior.
`test_a_pin_on_one_shape_of_a_drawing_stands_on_that_shape` comments on
two shapes of a wide drawing and requires each pin inside its own shape;
on `main` the left shape's pin stands at x≈1347 against a shape ending
at x≈402. `test_a_pin_on_a_contents_target_stands_at_its_last_part`
covers a `display: contents` target with side-by-side parts, which an
intermediate version of this branch withheld. The glossary,
`packages.md` and `page-authoring.md` now say a pin stands inside its
target's corner, and on a figure at the corner of the part a comment
names.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
)

`test_a_fragment_lands_after_presented_controls_take_space` (before
#2485,
`test_the_feature_gallery_fragment_lands_after_presented_controls_take_space`)
can no longer fail, so this deletes it and its stale `cost_tiers.json`
entry.

It was written in 9df147a, when a docked margin row could take space
in the page above a fragment's target after the browser had landed it,
so presentation flushed margin layout before landing again. Since #1164
every margin row stands absolutely placed in the chrome's margin layer
("nothing it draws moves that content", `margin-layout.js`'s header), so
no row can push the target down. The test passes with the
`app.overlay?.flushLayout()` before `landFragment()` removed, and still
passes with Chrome's scroll anchoring turned off; a per-frame probe
showed the target and the document height unchanged while twenty margin
clusters arrived above it.

The landing a user depends on stays covered by
`test_an_arrival_keeps_a_readable_native_fragment_where_the_browser_landed_it`
(a fresh fragment lands at the landing edge) and
`test_a_gallery_import_settles_before_initial_presentation` (the
destination stays in view through a deferred interface start). Both pass
on this branch.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Nov 5, 2026
Under a finger a comment's pin draws 44px across, its face as large as
the aim floor (#1164), and it stands over the words beside it. The
candidate was to draw it at 26px, as under a mouse, inside a 44px aim
given by a reach, as Leaf's buttons have, and to build it only if that
stayed simple. It doesn't, so this PR changes no behaviour: it adds a
`TODO(#4041)` at the pin's size rule (`--margin-entry` in
`annotation-theme.css`) saying what the change needs.

## Why it isn't simple

The seat search in `margin-placement.js` reads one box per pin. The
smaller face needs two: the face, kept off words and touching its
target, and the aim, kept off controls and other rows. CSS can give a
pin one box or the other, and each choice breaks one of those.

- **Row as the aim.** The attempt gave the face 9px margins, so the
row's box was the 44px aim and every seat stayed as on `main`, plus a
`::before` reach positioned only under a finger, so mouse pages keep the
unpositioned faces #5375 gave them. That came to 26 added and 6 removed
lines of CSS, comments included. But a pin seated outside its target
(above, below or beside it) now draws its face 9px further from it. At
phone width `leaf-dev pins --base` flagged 18 more of its 26 cases as
`far` (more than 12px from the target), 20 in all against 2 on `main`,
and
`test_each_pin_case_seats_its_pins_by_their_targets_clear_of_what_they_hide[phone]`
would fail on them.
- **Row as the face.** Seating the 26px face lets the 44px aim lie over
a neighbouring row or button and take its press, on 9 of 270 sentences
in the earlier measurement.

Doing it properly means passing the reach through `seatsBy`, `seatRow`,
`pinSpot`, `leastCovering`, `slid` and `packRow`, and through the fold
widths in `margin-layout.js`, with runtime tests for each. That is new
geometry code in Leaf, which the bar for "simple" excluded. I haven't
built it.

## What the CSS-only attempt measured

- `leaf-dev probe --viewport phone --base` on a three-paragraph fixture,
in Chromium and Firefox: every row kept its seat (49×44 at the same
coordinates), the face drew 26×26 centred in it, and presses 18px left,
right, above and below the face's centre landed on the pin.
- A sweep of 13 examples at 390×844 under touch, with a comment on every
sentence (up to 25 a page, all at once), read in Chromium: of 176
sentences with a pin on both arms, the face covered a word on 68 on
`main` and 41 with the attempt. 27 got better and none got worse, and no
row moved. Because the seat search still avoided words with the 44px
box, this falls short of the earlier measurement's 4%, which seated the
26px face.

## Not verified

- The sweep in Firefox. The fixture probe showed the same seats and
faces there.
- A real phone.

Part of #4041.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 <[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