Skip to content

Draw the comment box in the placement gallery, and widen a carried box from the edge it holds - #7354

Merged
max-sixty merged 2 commits into
mainfrom
comment-box-width
Nov 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
comment-box-width

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

leaf-dev placement cards now draws the comment box beside the card Send opens. When the reader starts a thread, the gallery shows three tiles: the box as it opens, the box once a long first line is typed, and the card. Each tile names the edge the surface stands by. A card's tile flags a fault where it stands by a different edge than its box did, or opens slim at a different width. Five new cases cover the box's postures: beside words on either side, under a whole paragraph, over words at the page's foot, and carried by its grip. So a mismatch like the full-width box that #7329 fixed now shows as a row in the gallery.

The carried case found a defect in the width rule (comment-placement.js, size). A box dragged from its spot left of a block holds its left edge, but its width came from Floating UI's available width, which for a left placement runs leftward. So whether it widened depended on shift data. In the fixture it reached 515 px at 1728 px and stayed at 320 px at 1440 px. #7329 already took the lane, measured from the held edge, for a box under or over its subject. Now every surface does, which drops that branch.

To weigh: a carried box beside its subject now widens away from its left edge and may cover its subject, as one above it already did. Before #7329 it stayed at 320 px and wrapped. The gallery draws that cover without the fault chip, since the reader put the box there. The gallery's "room" is now measured from the held edge, which changes the existing under/over card readings.

Max asked for the box in the gallery on a Leaf page. Tests: a runtime case drops the box against the room's left edge (the old rule gives 320, the lane gives 1284); the 1151 runtime tests, the browser type check, and focused browser tests on grip, left-side and carried surfaces pass.

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

…x from the edge it holds

`leaf-dev placement cards` drew only thread cards. So when a comment box opened at
a different width than its card in some posture, nobody saw it until a user hit it,
as with the full-width box left of a wide block that #7329 fixed. For each thread the
reader starts, the gallery now draws three tiles: the box as it opens, the box once a
long first line is typed, and the card Send opens. Each tile names the edge the
surface stands by, read from floating.js. A card flags a fault where it stands by a
different edge than its box did, or opens slim at a different width. Five cases cover
the box's postures: beside words on either side, under a whole paragraph, over words
at the page's foot, and carried by its grip. "Its room" is now measured from the edge
the surface stands by, which changes the under/over card readings.

The carried case found a defect in the width rule. A box dragged from its spot left of
a block holds its left edge and widens rightward. But its width came from Floating UI's
available width, which for a left placement runs leftward from the box. So whether the
box widened depended on Floating UI's shift data. In the gallery's fixture, the dragged
box widened to 515 px at 1728×999 and stayed at 320 px at 1440×900. #7329 already
handled the same mismatch for a box under or over its subject, by taking the lane
measured from the held edge. Every surface now takes its width from the lane, so a
carried box widens away from its left edge at every window size. A carried box beside
its subject may now widen over the subject, as one above it already did. The gallery
draws that cover without the fault chip, since the reader chose where the box stands.

Before #7329, a carried box beside its subject stayed at 320 px in both windows and
wrapped. Under or over, the box widened.

Tests: a runtime case drops the box against the room's left edge. It widens to the
lane, and the old rule gives 320. All 1151 runtime tests pass. Focused browser tests
on the grip, left-side and carried surfaces pass.
@max-sixty
max-sixty merged commit 6dfd5a9 into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the comment-box-width branch November 27, 2026 06:05
max-sixty added a commit that referenced this pull request Nov 27, 2026
…to-left quote's first word, and keep a slim card's news count whole (#7363)

Three follow-ups Max raised on the page for #7354, each present on main
before it.

**A box under or over words now moves with them when they scroll
sideways.** `commentPlacement` kept two inline offsets: a box beside its
words kept its held edge's distance from the words, while a box under or
over them kept its distance from its measure-wide place, which the
room's edge clamps and a sideways scroll doesn't move. Every box now
keeps the first, so the second (`inline`) is gone. `choose` also keyed
its fresh choice on the target's left and right edges, though its
contract says width, so a scroll of a box around the log chose afresh
and jumped the box 272 px for words that moved 200 px; it now keys on
the width. In Firefox, a 200 px scroll of the log, or of a box around
it, now moves the box 200 px with the words; before, the first left it
where it opened.

**A box under right-to-left words starts at their first word.**
`commentAttachment` reads the declared `direction` of the quoted text's
element and takes the first line's right edge for `rtl`, running the
place leftward from it. On an Arabic page the box's right edge now
stands at the quote's first word; before, the box stood at the far left
end of the line. A right-to-left run inside a left-to-right element
follows its element, unless the run declares its own `dir`.

**A selection attaches to its first line of words.** `rangeGeometry`
took the first rectangle of `Range.getClientRects()`, which is the
border box of an element the selection starts across, so a box beside
words starting in a padded element stood level with the padding. It now
reads the words' own lines, as `passageGeometry` already did for a
resolved passage.

**A slim card's news count reads whole.** `#fitLineNews` counted the
first message's hidden Edit, Link and Copy (92 px) as room the head
needs, which a 320 px card never has, so it cut the count to "2 …"
beside blank room. The fit's width cap is gone, and the head gives way
in the order `surfaces.css` states. Under the pointer the three controls
still cover "Me" and the date on a 320 px card beside Previous and Next,
as they cover the end of every head's words.

Where to look: the carried offset in `landed` and `holding`
(comment-placement.js) now positions left-of-subject boxes too; the
placement gallery against main in Firefox shows its five comment-box
cases and three card cases unchanged at three window sizes.

Tests: runtime cases for a sideways scroll of the log and of a box
around it, and for a right-to-left place; browser tests for a
right-to-left quote, a padded start, and the card head at 320 px. Each
fails on main. An independent Codex review found the ancestor scroll and
the padded start, both fixed here.

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