Skip to content

Stand a withheld row's thread card by its passage, and let it leave with it - #824

Merged
max-sixty merged 9 commits into
mainfrom
thread-open-no-scroll
Sep 19, 2026
Merged

max-sixty merged 9 commits into
mainfrom
thread-open-no-scroll

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

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

max-sixty and others added 8 commits September 18, 2026 13:26
Pressing marked words that carry a thread moved the viewport: at 1440x900, a
passage low in the window jumped 391px (an Ask's words, 399px) as the page centred
it. `openPageThread` travels to the anchor for every caller, and `scrollToThread`
skips the trip only while the passage clears the bottom shortcut bar's
scroll-padding, so words the reader can see and press inside that band still
counted as covered.

A press on the words now passes `travel: false`. The t/T walk and the comment note
keep travelling, since both can open a thread about a passage off screen. The card
needs no trip: placeThreadPreview keeps it inside the viewport, and without the
centring it opens taller (502px rather than 416px).

The new test shares its fixture with the keyboard walk's clearance test: same words,
same place, and only the gesture differs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The margin card branch computed a reply-box destination and handed it to
landInConversation when `focus` was "reply". No caller reaches it: the walk and the
comment note pass "thread", and the mark press passes "reply" only when the Threads
panel is open, which `setPanel` writes together with the state `openPageThread`
checks first, so that press goes to `showThread` instead. The card now always lands
on the thread, and margin-projection no longer takes landInConversation.

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

Below about 820px the margin has no room for a thread's row, so the row is
withheld and its box is empty. `placeThreadPreview` anchored the card to that
box, which put the card in the top corner over the words the reader had just
pressed. It anchors to what the row is about when the row has no place of its
own, so the card flips above or below the passage as it does beside a rail.

Two face tests still asked for the solid accent fill #803 took off every
pressable: the composer's send disc and the option-addition form's Add press
both state readiness in their own ink now, over a disc that stays clear until
the pointer is on it. Both tests were red on main.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
# Conflicts:
#	tests/test_render_anchors.py
Two conflicts, both where main had moved onto this branch's ground.

#810 replaced Floating UI and the lane rules with one arithmetic rule in
`thread-card-geometry.js`, rewriting the whole of `placeThreadPreview` around
it. It kept the pre-existing `closest("[data-lf-margin-for]")` and not this
branch's one added line, so a withheld row still hands the geometry an empty
box: measured at 820x800, the card stands at 96-286 over the pressed words at
151-172. The line is re-applied to the new structure, naming the boundary's
corner rather than the viewport's, which is where #810's boundary now puts it.

#814 repaired the same two stale face assertions this branch carried, through a
shared `glyph_action_face` helper beside `token_colour` and `button_radius`.
That is the better home for the reading, so `test_render_options_addition.py`
takes main's version whole and this branch keeps nothing of its own there.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t its placement

The empty box a withheld row hands `placeThreadPreview` decides two things, and
anchoring to the passage instead was already fixing both. The second one had no
test.

`threadCardGeometry` calls a card detached when its cluster has left the
boundary. An empty box has left it by definition — `cluster.bottom` is 0 and the
boundary's top edge is under the banner — so the card read as detached on its
first placement, never set `previewReferenceSeen`, and so could never take the
dismissal every scroll offers it. Measured at 820x800: the passage scrolls 900px
away and the card is still open, and stays open for the rest of the page's life.
With the cluster standing by the passage it leaves when the passage does.

Co-Authored-By: Claude Opus 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.

Two things the placement change leaves open.

The module header still states the old contract. The card paragraph in margin-projection.js's header reads "The thread card stays attached to its owning cluster" and "closes it once its cluster has left that boundary". Neither sentence holds at 820px any more — the card stands by the page target and leaves the boundary with the target — so the only written statement of the new rule is the inline comment at the call site, while the header a reader reaches first says the opposite. skills/leaf/assets/CLAUDE.md makes that header the module's contract: "Everything one module owns is stated in that module's header comment, and the map below names the owner of each concern, so read the header before changing the module." A clause in that paragraph settles it — something like "Where the margin has no room for that cluster, the card stands by the page target the row is about, and leaves the boundary with it." I can push that if you'd like.

checkVisibility() narrows the guard to one of the two reasons a row is withheld. margin-layout.js marks lf-withheld when the rail cannot take the row (options.fallback === "hide") and, before that, when the target itself is not shown — the shown: reading the projection registers is shownParts(target).some((part) => part.checkVisibility()). This fix covers the first case, where the row has no box and the target has one. In the second the fallback has no box either, so the cluster is the zero rect again and both readings the description names go wrong again: corner placement, previewReferenceSeen never set, no dismissal on scroll. Reading the open path, that does not need a visible control to press — openPageThread hands the key to openInlineThread, whose !button?.isConnected bail does not fire because a display: none row is still connected.

It is pre-existing rather than introduced here, and closing it looks like a call this review cannot make: a card with nothing to stand by either declines placement, leaving an open dialog at opacity: 0, or reads as detached from its first placement and takes the first scroll's dismissal before the reader has seen it stand anywhere. What I would not leave as is, is the comment — it names the rail shortfall as the reason the box is empty, and the next reader will take the empty-box trap as closed.

…d rows it covers

The header still said the card stays attached to its owning cluster and closes
once that cluster leaves the boundary. Where the rail has no room for the
cluster it now stands by the cluster's page target and leaves with it. The
call-site comment named only a withheld row, which reads as every withheld row;
a row whose target is not shown is withheld too, and that target has no box
either, so it names the case it covers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a76c60a into main Sep 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the thread-open-no-scroll branch September 19, 2026 02:20
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