Repository navigation
fix: keep margin message controls placed during send motion - #4630
Merged
Merged
Conversation
A message translation makes it the containing block of its controls, invalidating their anchor to that same message. Use the message as a stable positioned container and place its later-message controls directly at its head line and edge. The held-send regression fails before the fix with the reported 485px horizontal and 14px vertical offset. Closes #4628
max-sixty
added a commit
that referenced
this pull request
Oct 30, 2026
…4717) 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 #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 #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_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A margin message's send animation temporarily makes the message the containing block of its controls. The controls' CSS anchor to that same message then stops resolving: Copy sits 485px left and 14px above its intended place, and jumps back when translation ends. This reproduces the exact offsets reported in #4628.
Later margin messages now place Copy, Edit and rewrite actions directly inside a positioned message box at its right edge and head line. This removes the self-anchor and keeps placement consistent while translated and at rest. The affected visible state is the existing message's controls during a reply send; their resting placement stays the same.
The new regression holds a real send's animations just before completion, checks Copy's position relative to its message, then finishes motion and checks it again. It fails before the fix with
right: -485, top: -14and passes after it.Validation: regression and existing Markdown-copy test; card rewrite and touch-header tests; all four pending-margin-reply smoke cases at 6× CPU throttling; 696 runtime tests; focused pre-commit hooks. Before/after stills matched for the drafted reply and, on repeat, the keyboard-focused card. The first keyboard-card capture pair differed in card height and scroll position; the repeated pair matched.
Closes #4628 — automated triage