Skip to content

Lay out a thread message's controls as one group at its head's end - #4717

Merged
max-sixty merged 19 commits into
mainfrom
message-controls-group
Oct 30, 2026
Merged

max-sixty merged 19 commits into
mainfrom
message-controls-group

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A thread message's controls — Edit, Add reaction, Copy, and an open rewrite's Discard and Save — are now one group at the end of the message's head, placed by the head's flex row. Before, each control was positioned absolutely against the head's anchor, Edit and the reaction trigger were offset past Copy, and the head reserved room for them with widths set per case (--lf-msg-control, --lf-msg-head-room, --lf-msg-controls-width, --lf-msg-edit-width, --lf-thread-message-control-room). The browser code is +294 −317 lines against main (whitespace ignored, comments included).

How the group is laid out

messages.js renders <span class="lf-msg-control-room"><span class="lf-msg-controls">…</span></span> as the head's last item (controls.css):

  • The room is as wide as the group and gives up its width before anything else in the head (flex: 0 1e12 auto; min-inline-size: 0), keeping the group end-aligned. So a squeezed head's words run under the hidden controls, and when the controls show they stand over the words' end, on the message's ground, with nothing moving. That is Let a message head's words use its hidden controls' room, and cut a squeezed head's time before its name #4661's behaviour, rebuilt on the group instead of a ::after box sized per case.
  • The room stays whole beside a primary reader's news notice, beside a page thread's first-message controls, under a finger (where the controls always show), and, with one control's width, while a progress disclosure waits for its answer's reaction trigger.
  • The reaction trigger is drawn by ReactionStripView.trigger into the group and registers through a Lit ref, re-registering whenever Lit draws a new button. The strip below the words holds only the palette.
  • Discard and Save leave the editor's DOM for the group (message-edit.js), so the editor's Escape scope also covers them, and the floating panel's rewrite check asks whether a node stands in a message being rewritten rather than inside its editor. Beside a seat's first message, where Resolve leaves while a rewrite is open, the head takes Resolve's room, so the pair stands in Resolve's place by layout, as the margin card's head already did.
  • The head cuts what it can't fit only at its inline end, a gap past it (clip-path), so focus rings and touch reach above and below it stand whole; the margin card's metadata clips its own rising labels.
  • The news fit (#fitMarginNews) and the held-news header slot in thread-card.js measure the group rather than the head's padding.

What looks or behaves differently

  • In Firefox the reaction picker now hangs 4px below its trigger, as in Chromium; on main Firefox put it 18px below.
  • A later message's head in a margin card spans both card tracks, so its controls end at the card's edge by layout, replacing fix: keep margin message controls placed during send motion #4630's offsets inside the message box, and its name and time get the whole row. While it sticks on the line of the card's Expand, Resolve and Close, it keeps to the first track (data-lf-beside-actions), as every head did on main, and its controls stand aside there, as Edit and Copy did on main. An answer's reaction trigger now stands aside too; an open rewrite's Discard and Save stay.
  • An open rewrite's Discard and Save precede its field in Tab order, as they do on screen; Shift+Tab from the field reaches Save, then Discard, Escape there still discards, and Tab from the field goes on to the thread's controls. A message's Add reaction likewise precedes its own widgets.
  • Tapping Edit on a phone card's first message while news waits leaves the card where it stood, the released messages below in its transcript. On main the card rose 180px under the finger to show them: Edit leaves as the rewrite opens, so card-anchor.js reads the press from the next element up, which on main was the message, moved by the transcript's scroll, and is now the controls group in the sticky head.
  • Under a coarse pointer a thread's Expand, Resolve and Close drop the 4px gap between their 44px boxes, standing 44px apart rather than 48px.

Tests

  • reaction-strips.test.mjs adds a case for a trigger drawn again, which registered stale before.
  • test_a_rewrite_is_the_reply_box_where_the_words_stood now checks that a pointer reaches Discard and Save on each surface, and test_a_rewrite_keeps_its_pair_while_its_head_sticks_beside_the_actions covers a later card message's rewrite whose head sticks on the actions' line. A reviewer found both cases broken on this branch before the fix. test_a_card_s_head_stands_whole_beside_news looks Edit up in the head's group; it had accepted finding none.
  • Browser tests take new selectors for the moved trigger and pair. test_progress_disclosure_keeps_its_words_visible_beside_margin_paging checks what each head on the actions' line shows rather than every head's box, since a later head below that line now runs to the card's edge, and it reads the card after its entrance motion ends. test_a_rewrite_of_a_comment_just_sent_is_the_reply_box reads Edit's ring after the card's growth from the comment box ends; it passed on main only by finishing a few milliseconds sooner.
  • Journey tests got the same selector changes and weren't run locally.

Checked locally: pnpm run test:runtime, pnpm run check:browser, and about 190 targeted browser cases over rewrites, head layout, the controls' room, news fits, reactions, summaries, seated threads and touch; probes against main in Chromium, Firefox and a 390px touch viewport; a Codex review of the code, and a fresh agent's use of each surface on both versions.

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

# Conflicts:
#	dist/kernel/runtime/bundle-data.js
# Conflicts:
#	browser/runtime/annotation-overlay/annotation-chrome.css
#	dist/kernel/runtime/bundle-data.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
…er its growth

A primary reader's notice stood in the head unpositioned, so its reach
(::after, inset 0) took the message as its box and covered every word: a
double-click on the first message's words opened the news instead of a
rewrite. It is positioned again, at no offset.

The rewrite ring test focused Edit while the card's growth from the comment
box still cut what stands past its edge, passing on main only by finishing a
few milliseconds sooner. It now waits for that motion to end.
Main's #4652 fits a margin card's held notice of news to the room the heads
leave beside each name and time, counting the Edit a head kept room for in its
padding. Here a head's controls are a group in its row, so the fit counts the
group, and the rule parting a first message's controls from the thread's
stands past the head's end rather than the group's, which a card short of room
lets run past the head.

A head too narrow for what it holds now cuts it a gap past its end again, as
main's clipping head did, but only at that end, so its controls' rings and a
finger's reach still stand above and below it. A later message's head keeps to
the first track while it sticks on the actions' line, with the cell beside it,
so nothing it holds runs under a narrow card's actions.

The progress-disclosure test now checks what each head on the actions' line
shows rather than every head's box, since a later head below that line runs to
the card's edge. Its 311px touch case fails on main too.
Main's #4661 lets a head's words run into its controls' room while the
controls hide, and stands the controls over the words' end on the message's
ground when they show (the user's pick, 28 October). It built the room as the
head's ::after sized by --lf-msg-control, with a ::before ground, beside
controls positioned on the head's anchor.

Here the controls are one group, so the group now stands in a room of its own
(.lf-msg-control-room), the head's last item: it is as wide as the group,
gives up its width first, and keeps the group end-aligned, so a squeezed head's
words run under the group and the group stands over them. The group paints the
message's ground behind itself while it shows, and always while a rewrite's
Discard and Save stand in it. The room stays whole beside a notice of news,
under a finger, and, as before #4661, with one control's width while a progress
disclosure waits for its answer's reaction trigger, which this branch had
dropped. The news fit reads the group's width, and what part of it the room
lends, rather than --lf-msg-control, whose @Property goes.

The receipt test reads the controls inside the head.
The progress-disclosure test now reads the card's heads once the card's own
motion has ended: at 311px under touch its entrance was still running, and the
actions and the transcript stood at positions read from different frames, so a
later message's head looked as if it shared the actions' line.
A seat's first message lost Save to its head's clip and the empty
thread-controls box while Resolve was away; the head now takes Resolve's
room and the box goes with Resolve. A later card message whose head
sticks beside the card's actions keeps an open rewrite's pair, standing
over the head's words rather than past its end into the actions. The
margin-news test finds Edit in the head's group instead of accepting
none. Under a coarse pointer a thread's controls drop the gap between
their 44px boxes.
leaf-agent
leaf-agent previously approved these changes Oct 30, 2026
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit 561e0b4 into main Oct 30, 2026
4 checks passed
@max-sixty
max-sixty deleted the message-controls-group branch October 30, 2026 04:42
max-sixty added a commit that referenced this pull request Nov 1, 2026
#4717 made the controls' room an element (`.lf-msg-control-room`) with its
own `flex: 0 1e12 auto`. The order block in surfaces.css now names that
element first, and controls.css sets no weight on it. A primary reader's
notice of news, which #4717 put in the head's flow, gives way with the
metadata, as it shared shrinking with it on main.

The phone arm of `test_a_card_s_head_stands_whole_beside_news` now writes
its message 51 days back: under heavy load the run outlasted a minute,
"just now" turned "1m ago", and the shorter time stood whole on the phone.
leaf-agent added a commit that referenced this pull request Nov 1, 2026
The native-layout readiness check and rewrite control actionability
check supplied private 30-second and 2-second timeouts, overriding the
suite's shared deadlines. Remove both overrides so readiness uses its
shared handover deadline and trial clicks use the browser fixture's
default. The assertions and the behavior exercised by #4724 and #4717
stay intact.

The existing deadline audit fails with both calls before this change and
passes afterward. All four rewrite surface cases pass. The native-layout
startup case independently fails its geometry equality assertion on both
unchanged current main and this candidate: the wide exhibit shrinks from
189.25px to 187.96875px after activation. That separate failure is
tracked in #4985.

Closes #4925 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 1, 2026
The transparent message header was above the held-reply notice in the
paint stack, so axe could not measure the notice’s “2 new replies” text.
The `clip-path` introduced in #4717 makes the header a stacking context.
Giving the later notice its own stacking context with `isolation:
isolate` restores document paint order while keeping the header’s
clipping and the notice’s existing allocation.

The four held-seat reply cases reproduce the overlap before this change
and pass after it. They preserve withheld replies, notice activation,
reply order and stable reading height. The diff-thread keyboard cases
and inline-thread surface check also pass (seven browser cases total),
as do all 737 runtime tests and `pnpm run check`. The existing overlap
assertion remains unchanged.

<details><summary>Paint-stack evidence and visual comparison</summary>

At the failing assertion, `axe.commons.dom.getTextElementStack` places
`.lf-msg-head` before the span containing “2 new replies”. The notice’s
text starts at x=468.94, beyond the retained header words’ edge at
x=460.94; it is the transparent header box spanning x=257–920 that
covers it, rather than overlapping author text. The one-rule fix changes
stacking without changing these allocations.

The `hub-seat-held-news`, `hub-seat-held-news-phone` and
`plan-card-held-news` stills are unchanged. The seated-thread desktop
pair is shown below:

| Before | After |
| --- | --- |
| ![Seated thread
before](https://github.com/user-attachments/assets/1cf590d3-3e71-4141-9a90-810e33d0800f)
| ![Seated thread
after](https://github.com/user-attachments/assets/e7b58891-08eb-4f91-85d0-bde64b8ccd3e)
|

</details>

Closes #4953 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 2, 2026
A squeezed message head gives up its parts in one order: its hidden
controls' room, then annotations such as the "Queued for Agent" receipt,
then its time, then its name (the user's choice, 28 October). That order
was three shrink weights spread over two stylesheets and scoped to
margin cards, while the panel's, page threads' and the full thread
reader's heads kept the name from shrinking and clipped the time with no
ellipsis. The margin news fit also worked the order out again in script
to decide when to hide a name. Now one block states it for every head.

- **The order** (`browser/styles/components/surfaces.css`): one ordered
block gives each part its weight: the controls' room
(`.lf-msg-control-room`) `1e18`, the metadata's annotations `1e12`, the
time and the metadata box `1e6`, the name `1`. Each weight is a million
times the next, so a part gives up all its room before the next gives up
any visible width. CSS can't take a weight from a rule's position, so
moving a part swaps two weights. A primary reader's notice of news,
which #4717 put in the head's flow, shares the metadata's weight, so the
two give way together as they did before. `controls.css` and
`annotation-chrome.css` set no weights. Every head now cuts a squeezed
time and receipt with an ellipsis and caps a long name at 40% of the
head or 5em, whichever is wider, as margin cards did.
- **The news fit** (`#fitMarginNews`,
`browser/runtime/thread/thread-card.js`): it reads how much of each name
the notice leaves as drawn instead of recomputing the order. A name cut
below an em still hides (`data-lf-nameless`), now with `clip-path`,
keeping its box. Before, its room went to the time, which showed a
sliver of itself ("5." of "51d ago" on a 160px card). A whole name
narrower than an em, such as "A", is no longer hidden.
- **The working head** (`browser/runtime/thread/transcript.js`): its
condition ("Stopped") was bare text the order's rules couldn't reach; it
is now a span among the annotations.

Behavior changed in tests:
- `test_a_squeezed_head_gives_up_one_part_at_a_time` is new. It narrows
a queued message's head from 2000px to nothing and checks that the room,
the receipt, the time and the name give way one at a time in that order,
each giving all it can.
- `test_a_card_s_head_stands_whole_beside_news` dates its message 51
days back. Under heavy load a run outlasted a minute, "just now" became
"1m ago", and the shorter time stood whole on the phone.

Checked in Chromium and Firefox. Before-and-after stills of 22 thread,
card and panel states differed only in a reply field's caret, and so did
11 of them taken again after the merge with #4717.

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