Skip to content

Place the thread card by one rule instead of lanes and Floating UI - #810

Merged
max-sixty merged 3 commits into
mainfrom
thread-placement
Sep 18, 2026
Merged

max-sixty merged 3 commits into
mainfrom
thread-placement

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The inline thread card was placed by Floating UI through a virtual reference
that stood for a chosen page lane. In practice the lane was almost never
taken. Measured on the feature gallery at 900px tall: at 1440px the card fell
a few pixels short of standing beside its cluster, so crossesSource stacked
it above the cluster and capped its height at the room there, clipping the
conversation; below about 1100px it kept its full 460px measure and hung from
the cluster's right edge, most of the card over the reading column. The left
lane could never win, because main shifts left by half the rail, so the
right lane is always the wider one.

thread-card-geometry.js now states the whole rule as arithmetic over the
cluster's and the boundary's client rectangles. The card stands in the rail
beside its cluster, top edges aligned, as wide as the room there allows
between its minimum and preferred measures. With less than the minimum beside
it, the card keeps its right edge on the visible edge and takes the room from
the cluster's left edge, so the controls that opened it stay clear and it
crosses the reading column by no more than the rail's shortfall. Read at the
shipped cluster positions: at 1440px the card stands beside its cluster 453px
wide; at 1160px it stands under the cluster 358px wide, its left edge exactly
on the cluster's left edge and so clear of the column; at 1024px it takes the
320px minimum, which is the one case that crosses the column, and crosses it by
153px — what the rail lacks — rather than by most of the card's width.

The boundary alone caps the height

A card too tall for the room under or over its cluster used to take that
room's height as its cap, which cut a conversation to keep a 32px control
uncovered. The rule now names a preferred spot and lets the visible
boundary's clamp have the last word: beside the cluster; else under it when
the whole card fits there; else over it when it fits there; else under it
again. The boundary's height is the only cap, so such a card holds at the
boundary's foot, across the controls that opened it, at full height — 486px
unclipped at 1024px, where neither the room under its cluster nor the room over
it reaches 380px. A card that does fit still leaves them uncovered. The same clamp is what a scroll
meets — the card slides with its cluster, then holds at the foot until the
cluster itself has left, which closes it as before.

The margin projection supplies the boundary (the reading region, else the
viewport under the banner and over the bottom chrome), writes that cap,
measures the card under it, and applies the result. Placement is synchronous
now, so a card is where it belongs in the turn that opens it, and the epoch
guard for stale asynchronous answers is gone. placedThreadPreview keeps the
one promise callers still need, for a popover the browser refused this
rendering turn.

The vendored Floating UI bundle drops hide, which only this card used; the
comment composer still imports the bundle lazily. The geometry module is one
more 2.6KB same-origin module in the static graph before presentation; in
exchange the first card a reader opens no longer fetches the 16.7KB bundle,
and nothing about the card waits on a network answer.

Tests: the everyday gate carries the rule as a table over the pure module,
including the postures the old placement could not reach. The margin geometry
tests that asserted the old shape now assert the posture they arrange — the
wide-cluster case is below; the free-margin case reads tracking with the
cluster high enough for the card to fit, then the hold at the foot; the
sidebar page's card takes the minimum at the visible edge rather than the full
measure hung from the cluster; and the shipped long thread's 1472px step,
where a wide cluster leaves too little beside it, holds its height instead of
standing clear of its own controls. Two new margin tests pin the 1440px
beside-with-room and 1024px minimal-crossing cases, a pane-frame card is
checked against all four edges of the body it must not be confined to, and the
two startup tests that held the card transparent while Floating UI loaded, or
withdrew it when the load failed, go with the states they held.

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

🤖 Generated with Claude Code

max-sixty and others added 3 commits September 18, 2026 12:25
The inline thread card was placed by Floating UI through a virtual
reference that stood for a chosen page lane. In practice the lane was
almost never taken: at 1440px the card fell 7px short of standing beside
its cluster, so `crossesSource` stacked it above the cluster and capped
its height at the room there, clipping a 502px conversation to 378px.
Below about 1100px the card kept its full 460px and hung from the
cluster's right edge, 401px over the reading column. The left lane could
never win, because `main` shifts left by half the rail, so the right lane
is always the wider one.

`thread-card-geometry.js` now states the whole rule as arithmetic over
the cluster's and the boundary's client rectangles. The card stands in
the rail beside its cluster, top edges aligned, as wide as the room there
allows between its minimum and preferred measures. With less than the
minimum beside it, the card stacks under or over the cluster at the
minimum with its right edge on the visible edge, so the controls that
opened it stay uncovered and it crosses the column by exactly what the
rail lacks: 153px at 1024px instead of 401px. Every posture clamps into
the boundary and caps its height to the room it stands in, so a scroll
slides the card with its cluster and then holds it at the boundary's
foot until the cluster itself has left, which closes it as before.

The margin projection supplies the boundary (the reading region, else
the viewport under the banner and over the bottom chrome), measures the
card, and applies the result. Placement is synchronous now, so a card is
where it belongs in the turn that opens it, and the epoch guard for
stale asynchronous answers is gone. `placedThreadPreview` keeps the one
promise callers still need, for a popover the browser refused this
rendering turn.

The vendored Floating UI bundle drops `hide`, which only this card used.
The geometry module is one more 2.7KB same-origin module in the static
graph before presentation; in exchange the first card a reader opens no
longer fetches the 16.7KB Floating UI bundle, and nothing about the card
waits on a network answer.

Tests: the three margin geometry tests that asserted the old shape now
assert the posture they arrange (the wide-cluster case is `below`; the
free-margin case reads tracking with the cluster high enough for the
card to fit, then the hold at the foot; the sidebar page's card takes
the minimum at the visible edge rather than the full measure hung from
the cluster); a pane-frame card is checked
against all four edges of the body it must not be confined to; two new
margin tests pin the 1440px beside-with-room and 1024px minimal-crossing
cases; the everyday gate carries the rule as a table over the pure
module; and the two startup tests that held the card transparent while
Floating UI loaded, or withdrew it when the load failed, go with the
states they held.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
With a short rail the card stood under or over its cluster and took that
room's height as its cap, so at 1024px a 486px conversation was cut to
378px, its pasted image reduced to a sliver, to keep a 32px control
uncovered.

The rule now names a preferred spot and lets the boundary's clamp have
the last word, in every posture: beside the cluster; else under it when
the whole card fits there; else over it when it fits there; else under
it again. The boundary alone caps the height, so a card too tall for the
room under or over its cluster holds at the boundary's foot, across the
controls that opened it, at full height. A card that does fit still
leaves them uncovered. `maxHeight` leaves the geometry's answer, since
it is the boundary's height in every case, and the margin projection
writes that cap before it measures.

Tests: the rule's table drops the capped cases for a tall card in a
short rail (holds at the foot, across the cluster), one that fits under,
and one that fits over; the 1024px margin test asserts the conversation
is unclipped and taller than either room rather than clear of the
controls; and the shipped long thread's 1472px step, where a wide
cluster leaves 306px beside it, holds the same instead of a card clear
of its controls, under a name that says so.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@max-sixty
max-sixty merged commit 497376e into main Sep 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the thread-placement branch September 18, 2026 23:33
max-sixty added a commit that referenced this pull request Sep 19, 2026
…ith it (#824)

Below about 820px the margin has no room for a thread's row, so
`margin-layout` withholds it and its box is empty. `placeThreadPreview`
handed that empty box to the geometry as the cluster the card stands by,
and an empty box decides two things wrongly.

**It puts the card over the words the reader just pressed.** A zero rect
leaves room beside it at any width, so the card takes the `right`
placement in the boundary's top corner. Measured at 820x800, the card
spans 96–286 and the pressed words sit at 151–172, wholly under it.
Anchored to what the row is about, the card stands under the passage,
right-aligned to the visible edge, as it does under a cluster that has
too little room beside it.

**It also makes the card outlive its subject.** `threadCardGeometry`
calls a card detached once its cluster has left the boundary, and an
empty box has left it by definition: its bottom is 0 and the boundary's
top is under the banner. So the card read as detached on its first
placement, never set `previewReferenceSeen`, and could never take the
dismissal every scroll offers it. Measured at the same size: the passage
scrolls 900px away and the card stays open for the rest of the page's
life. [#810](#810) describes the
card holding at the boundary's foot "until the cluster itself has left,
which closes it as before", which holds wherever the row has a place.
With the cluster standing by the passage, the card leaves when the
passage does.

Both come from the same line: when the rail has no room for the row, the
card now stands by the page target it is about. The module header states
that standing now. A row is also withheld when its target is not shown,
and then the target has no box either; this change does not reach that
case.

## Verification

`test_a_withheld_row_opens_its_card_beside_the_passage` asserts both.
Against main's placement it fails on the first, with `the card spans
96–286 over the pressed words at 151–172`. The second hangs off the same
line, so the test cannot fail on it alone; its contrast was measured
with a probe on the same fixture and scroll, which found the card still
open with the line reverted and closed with it.

- `uv run pytest tests/test_render_anchors.py
tests/test_render_margin.py`: 205 passed
- `uv run pytest tests`: 1146 passed
- `uv run pre-commit run --files
skills/leaf/assets/runtime/margin-projection.js
tests/test_render_anchors.py`

Every other runtime reader of `[data-lf-margin-for]` resolves identity
(`lfTarget`, `dataset.lfMarginFor`, focus hosts) rather than geometry,
so none of them can be misled by an empty box.

This branch also carried a repair for two stale `--accent` face
assertions. [#814](#814) landed
the same repair through a shared `glyph_action_face` helper while this
was open, so `tests/test_render_options_addition.py` takes main's
version whole and nothing of that repair remains here.

> _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 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 19, 2026
…its pinned reply whole (#828)

Two defects in the margin's inline conversation card, both found while
reading a live Leaf page an agent was working on, and both reproduced
before being fixed.

**The transcript moved while the agent worked.** Every state read places
the card, and placing it wrote the list's scroll:
`keepThreadPreviewFocusVisible` nudged the list 12px toward the focused
reply, a check the pinned reply can never satisfy because it always sits
on the list's foot. On main that pulls a reader who has scrolled up back
down, 48px per agent status. The runtime the reported page runs
(`4d329c62`) also wrote a provisional height cap before its final one,
so the list briefly grew and clamped its scroll; after a real scroll
gesture to the end of the thread, a status parked the reader about a
third of the way up. #810 removed the provisional cap, and this removes
the scroll write. Placing the card now changes only its geometry; only a
landing, a send, or a step to another thread moves the transcript, which
`skills/leaf/assets/CLAUDE.md` now records as its own row in the
ownership table.

**The reply's focus ring was cut along its bottom.** The reply row is
sticky at the list's foot, and `scroll-padding`, where the list reserves
ring room, governs where scrolling puts a box rather than where a sticky
offset pins one — so the focused text box's outline fell outside the
scrollport and was clipped. The row now keeps `--here-ring-room` as
bottom padding, and the ring law in `chrome.css`'s header covers sticky
rows.

Two tests in `tests/test_render_margin.py`, each red on its own defect
on main and on `4d329c62`: one reads both of the pinned row's rings
through the layer's own ring reading, the other writes working and
waiting statuses with the reader partway up the transcript and at its
end. That second test switches scroll anchoring off on the transcript,
because the browser's anchoring restores a place a placement disturbed
within one task — the headless shell restored it in every run, while
headed Chrome scrolled by a real gesture kept the disturbed place.

Removing the focus-arrival scroll leaves a focused control inside a
message able to drift out of view when the window shrinks; Tab arrivals
still reveal natively and the runtime's own landings reveal explicitly.

🤖 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 <[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