Skip to content

Move a comment box with words scrolled sideways, start it at a right-to-left quote's first word, and keep a slim card's news count whole - #7363

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

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

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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

…ay first

At a margin card's least width, a head line holding news read "2 …" with
blank room before it. The news fit counted the first message's hidden
Edit, Link and Copy (92 px) in the room its head needed, which a 320px
card's line never has, so the fit cut the notice to its floor for
nothing: at rest the head never used that room, and under the pointer
the controls still covered its words. The cut dates from when the notice
listed its facts and fell back to a count. Since it says one count,
"2 new", the cut only ever read "2 …".

Now the notice stands whole at its count, and the head beside it gives
up its parts in the order surfaces.css states: its hidden controls'
room, its annotations, its time (clock, then day), its name. At 320px
beside Previous and Next the user's head reads "Me Oct 6" beside "2 new" in
Firefox and Chromium, and the stills state plan-card-held-news, one
thread at its least width, reads "2 new" where it read "2 …". A card at
the measure and the finger layout draw as before.

Under the pointer the controls stand over the words' end, as on every
head, so on a least-width card beside Previous and Next, where the three
are wider than the head's room beside its name, they cover "Me" and the
time while the pointer rests on the message. With one thread on the
target, "Me" and the day stay visible.

- thread-card.js: `#fitLineNews` keeps only the reading that hides a
  name cut below an em, and watches each head's width instead of each
  time's, which no longer feeds it. `wordsWidth` goes, and
  `contentsBox` (shown-box.js) is no longer exported.
- annotation-chrome.css: the notice's `--lf-news-room` cap goes.
- surfaces.css: the order's comment says where the card's notice and
  the shown controls stand in it.

Behavior changed in tests:
- test_a_card_s_head_stands_whole_beside_news's desktop arm opens its
  card at its least width and asserts the notice's words whole, "Me"
  whole, and the day shown with the clock given up. Edit clear of the
  time stays asserted under a finger only. It fails on the parent.
- TIMES_WHOLE reads each shown part of a time, which cuts its own words,
  where it read "just…" as whole.
- test_a_card_s_head_row_cuts_the_name_before_the_time becomes
  test_a_card_s_head_row_cuts_a_long_name_beside_a_whole_notice. It read
  the notice's button rather than its words, so it passed while showing
  "2 …", and its claim that the time stays whole no longer holds: a long
  name keeps its 5em cap, so at the least width "just now" reads "ju…".
  It asserts the notice whole and the name cut with an ellipsis.
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026
@max-sixty
max-sixty merged commit 5ce72be into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the comment-box-width branch November 27, 2026 07:30
leaf-agent added a commit that referenced this pull request Nov 27, 2026
…d carry it from its subject's whole left edge (#7383)

Two browser tests about a comment box beside words that move sideways
have failed on `main` since #7363. This fixes both in `commentPlacement`
(`comment-placement.js`) and keeps #7363's intent: a sideways scroll of
a box around the log still carries the comment box with its words, on
the side it already holds.

**A held side is chosen again when it runs out of room.** #7363 keyed
the fresh side choice on the subject's width instead of its left and
right edges, so motion the words share with their box no longer jumps
the box. It also stopped the choice when a transform carried the
paragraph 600 px toward the right rail, which left the box `right-start`
on a side with no room. `choose` now also chooses afresh when the room
beside the subject on the held side no longer fits the least card width.
That is the test `commentSide` already chose the side by, now shared as
`besideFits`. A sideways scroll that leaves room keeps the side, as
#7363 intended.

**The carried offset is measured from the subject's whole box.** #7363
removed the old edge key, so a box beside a part of a scrolled diagram
is no longer placed afresh when the part's left edge slides under its
scroller's edge. Its carried offset was measured from `clear.left`, the
clipped edge, which stops moving once clipped, so the box lagged the
part by 6 px. The offset is now measured from `extent.left`, the
unclipped box, which moves with its content. Quoted passages still
measure from their column. Both callers of `options` now pass `extent`.

What a user sees differently from current `main`:
- A comment box whose paragraph moves (by a transform) until the box no
longer fits on its side moves to the other side, as it did before #7363.
- A box beside a partly scrolled-away diagram part follows the part
exactly.

Nothing else should change. Every other placement keeps its side and
offset.

Verification:
- On `main`,
`test_render_aim.py::test_a_side_comment_rechooses_its_rail_after_horizontal_target_motion[inline]`
and `[ancestor]`, and
`test_render_reactions.py::test_a_visual_action_follows_its_own_scroller_even_when_the_target_is_gone`,
all fail. On this branch all three pass.
- `pnpm run test:runtime` passes 1176/1176, including #7363's runtime
cases for a sideways scroll of the log and of a box around it.
- `pnpm run check:framework` passes.
- Focused browser placement tests pass, including #7363's right-to-left
and padded-start cases and the side-keeping, rise and scroller-clip
tests (12 tests).

Closes #7380 — automated triage

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