Skip to content

Stand a quoted passage's comments in a margin row of their own, by its words - #3083

Merged
max-sixty merged 8 commits into
mainfrom
diagnose-oversized-shot-page
Oct 16, 2026
Merged

max-sixty merged 8 commits into
mainfrom
diagnose-oversized-shot-page

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A comment on a quoted passage used to share its paragraph's margin row. That row stood at the paragraph's top in the rail and at its corner as a pin, which on desktop could be a window's width from a one-word quote. Each quoted passage now gets a margin row of its own, the way a row that a pointing gesture names inside its target already does (groupFor). In the rail, the row stands level with the passage's first line. As a pin, it is seated by the passage's own words.

Grouping (annotation-inventory.js): comments quoting the same words share one row. Its key is built from those words and which occurrence of them in the paragraph it is, read with the page's own text reading (textNodesUnder, quoteFrom). A thread settling or arriving therefore doesn't rebuild the row or close a card open on it. Passage rows sort by where they start.

Placement (margin-layout.js):

  • A passage is measured by each segment's own text (passageBoxes), never by the box of an element it spans.
  • Its pin tries the seats a run of words gets, from seatsBy. A run's seat above its corner now hangs off its top-right corner, so the pin's pointed foot meets the words.
  • Where none of those is clear, the pin tries its paragraph's seats that lie within half the scroller's height of the words, so the pin stays on screen while the words do. Only then does it cover words, and its own words count twice, so it covers its neighbours' first.
  • The row is withheld once a scroller hides the quoted words, both in the layout pass and in a scroll's visibility reading.

Card and focus (margin-projection.js): threadEntryAt prefers the row the open card shows, so returning focus to the paragraph doesn't switch the card to another passage's thread. marginSpot matches the card's passage, so the card keeps clear of its own row.

Gallery and tests:

  • leaf-dev pins reads each comment's own row. A quote case accepts a far pin only where every seat by its words is on other words, so the pin takes its paragraph's clear corner, as on a phone or deep in a paragraph. Two new cases show a passage deep in a paragraph and deep in one taller than the window.
  • New browser tests check that a passage's rail row stands level with its words and is shared by comments on the same words. They also check that a passage scrolled out of a scrolling box or a bounded reading region withholds its row, whether a layout pass or the scroll alone hides the words.
  • The lf-draft test now expects two rows, both seated on the widget.

Reactions on the same words still stand on the target's row, since contribution entries carry no passage yet.

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

max-sixty and others added 6 commits October 13, 2026 23:05
…s words

A comment on a quoted passage used to share its paragraph's margin row, which stood
at the paragraph's top in the rail and at its corner as a pin: on desktop up to a
window's width from a one-word quote. A passage now gets its own row, as a row a
pointing gesture names inside its target already did (groupFor): in the rail it
stands level with the passage's first line, and as a pin it is seated by the
passage's own line boxes with the seat order a run of text gets, starting just after
its last word.

- annotation-inventory.js groups threads by the words they resolve to, keyed by those
  words (whitespace collapsed) and their occurrence in the target, so a thread
  settling or arriving does not rebuild the row or close a card open on it; passage
  rows sort by where they start.
- margin-layout.js measures a passage by each segment's own text (`passageBoxes`),
  never the box of an element it runs across, and withholds its row once a scroller
  hides its words though the paragraph still shows; marginSpot matches the card's
  passage, so the card keeps clear of its own row.
- threadEntryAt prefers the row the open card shows, so returning focus to the
  paragraph does not switch the card to another passage's thread.

Behaviour that changed in tests: the passage cases in `leaf-dev pins` no longer accept
a far pin, and it reads each comment's own row; the lf-draft test now expects two
rows, both seated on the widget. New tests cover the rail row's level and its sharing,
and a passage scrolled out of a box that scrolls.

Reactions on the same words still stand on the target's row; contribution entries
carry no passage yet.

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

With every seat by its words taken, a passage's pin covered the neighbouring words,
where main's pin stood clear at the paragraph's corner: on a phone, a one-word quote's
pin sat over the line above it. It now tries the paragraph's own seats next, those
lying wholly within half the scroller's height of the words, so the pin is still on
screen when the words stand mid-screen in a long paragraph or pane; only when none
of those is clear does it cover words, and then its neighbours' before its own, which
count twice.

The pins gallery gains a passage deep in a paragraph and one deep in a paragraph
taller than the window, accepts the far pin a crowded passage now takes, and scrolls
a case taller than the window to its first passage.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	.claude/skills/developing-leaf/references/glossary.md
#	skills/leaf/assets/runtime/annotation-overlay/margin-layout.js
A pin's pointed foot is its bottom-left corner. Above a word, the seat stood over the
inside of the word's corner, so the foot pointed at the word's middle or start; for a
run of words or a quoted passage it now hangs off the top-right corner, where the foot
meets it. A block's above seat is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
From review: the row key now reads the passage and the text before it with the page's
own reading (textNodesUnder, quoteFrom), which crosses declared shadow roots, so the
same words inside two widgets in one paragraph keep two rows; a scroll's reading of
whether a row still stands now measures a passage row by its words, as the layout pass
does, so a pane scrolling the quote away withholds its pin at once; seatsBy reads its
subject's bounds with union; pointed-place's contract says a selection stands by the
words it quotes. The pane test now scrolls the words away with no layout announced.

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

# Conflicts:
#	skills/leaf/kernel/kernel.json

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

The phone pin placement still misses the quoted words in the new quote-mid-line case. At the 390px viewport, test_each_pin_case_seats_its_pins_by_their_targets_clear_of_what_they_hide[phone] fails with {'quote-mid-line': [('far', 'quote-mid-line-p')]}: the pin is more than the gallery's 12px reach from “before it seats the pin.” This PR removes that case's previous far allowance, so the claimed close placement remains unmet. The pin's seat needs to meet that reach, or the gallery needs to explain why a distant seat is intended here.

max-sixty and others added 2 commits October 16, 2026 00:00
…ot-page

# Conflicts:
#	skills/leaf/kernel/kernel.json
CI's DejaVu wraps the phone paragraph so the quoted passage sits between full lines,
where every seat by it is on words and the pin takes the paragraph's clear corner,
as one-word does on a phone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 20911a5 into main Oct 16, 2026
3 checks passed
@max-sixty
max-sixty deleted the diagnose-oversized-shot-page branch October 16, 2026 07:20
leaf-agent added a commit that referenced this pull request Oct 16, 2026
The [failed main
run](https://github.com/max-sixty/leaf/actions/runs/38867808372) exposed
three margin outcomes after #3083: a release-notes suggestion pin
covered its own words, a moved suggestion's folded row hid Accept, and a
quoted passage marker moved one frame after its words scrolled. This
change keeps the new quoted-passage placement while restoring the inset
above seat for other inline targets. A passage row now uses the text's
scrolling CSS anchor, so its marker travels in the same frame as the
words.

The three reported cases failed on current `main` before the repair and
pass afterward. Focused quoted-passage rail and pane checks also pass.
The committed kernel is rebuilt; `pnpm run test:runtime` passes 495
tests, and `pnpm run check` passes. The run's two composer return
failures have a separate scrolling cause and are being repaired
separately.

Co-authored-by: leaf-agent <[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