Skip to content

Keep a margin reply's focus ring whole while the card grows - #4380

Merged
max-sixty merged 3 commits into
mainfrom
fix-card-ring-bottom-cut
Oct 27, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix-card-ring-bottom-cut

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

When a margin card's reply field grew, by Shift+Enter or a soft wrap, its focus ring lost an edge during the card's resize tween: the top edge for the whole tween (about 300 ms) on main, and, once that was fixed, the bottom edge for the tween's first 2–5 frames. Firefox and Chromium both show it.

While a card moves, box-motion draws the field's ring on the card's surface, which stands behind every part of the card, so anything the card paints over that surface hides the ring. Two kinds of paint did that.

  • Containers around the field. The margin thread (background: var(--paper)) and its reply row (background: inherit) painted paper of their own. The reply row has 16px of top padding, so its paper covered the ring's band above the field. Both backgrounds date from Keep margin replies on the conversation surface #640, when the thread wore a focus tint; the card's face has since become the thread's one ground, and box-motion holds that face transparent over its own fill while it moves. So both now paint nothing (annotation-chrome.css). At rest the card looks the same.
  • The field's own ground. .lf-compose-field paints its own paper, and its layout already stands at its grown size, so that paper covered the ring's edge on the side it grows toward until the ring had nearly reached its rest. On main the reply row's paper was clipped to its old outline while it moved, which clipped the field's paper too and hid this; removing the row's paper exposed it. The surface now draws the ringed part's ground along with its ring: the ring's fill takes the part's background colour, and the part stands transparent while it moves, as the card's face already does (drawRing in box-motion.js).

The box-motion.js header now states the rule: the box's face is the only ground between the surface and a ring it draws, and the surface draws the wearer's own ground inside the ring.

Measured in recordings at 25 fps, counting frames where the ring shows its top edge but not its bottom (soft wrap / three Shift+Enters):

main containers only this PR
Firefox 0 / 0 8 / 11 0 / 0
Chromium 0 / 0 13 / 19 0 / 0

and frames missing the top edge fell from 27–37 on main to 0. The floating panel's field paints no ground and nothing between its card and field paints, so it is unchanged.

Tests:

  • test_a_growing_margin_reply_keeps_its_whole_ring_from_the_first_frame (new) holds the growth at its first frame and checks the ring's top and bottom bands are drawn in its colour; without the drawRing change the bottom band reads 0%.
  • test_a_margin_reply_shares_its_threads_opaque_surface becomes test_a_margin_reply_stands_on_its_cards_face: the thread and reply row paint nothing over the card's opaque face as focus enters and leaves.
  • test_a_margin_card_is_one_frame_that_rings_for_its_thread checks "no tint" as the thread painting no ground rather than painting paper.

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

max-sixty and others added 3 commits October 26, 2026 23:04
In Firefox, when a margin card's reply field grew, by Shift+Enter or a
soft wrap, its focus ring lost its top edge for the whole growth tween
(about 300 ms); the sides and bottom stayed.

While a card moves, box-motion draws the field's ring on the card's
surface, which stands behind every part of the card. Two containers
between the card face and the field painted paper of their own: the
margin thread (`background: var(--paper)`) and its reply row
(`background: inherit`). The reply row spans the field's width with
16px of top padding, so its paper covered the ring's 2px band above the
field, while the side and bottom bands fell outside it.

Both grounds date from #640, when the margin thread wore a focus tint
and a pinned reply row had to match it. The card's face has since
become the thread's one ground (the thread "fills it with no ground or
ring of its own"), and box-motion holds that face transparent over its
own paper fill while it moves, so the two backgrounds were redundant
paint. The thread now paints `none`, which still overrides the quiet
ground the theme gives a thread holding focus, and the reply row paints
nothing. At rest the card looks the same: both read transparent over
the card's opaque paper, focused or not.

In a Firefox recording of three Shift+Enters, frames showing the side
ring without the top fell from 27 to 0.

box-motion.js now states the rule: the box's face is the only ground
between the surface and a ring it draws. The floating panel already
keeps it; nothing between its card and its field paints.

test_a_margin_reply_shares_its_threads_opaque_surface asserted the
thread and reply row were opaque and matched; it becomes
test_a_margin_reply_stands_on_its_cards_face, which asserts they paint
nothing over the card's opaque face as focus enters and leaves; and
test_a_margin_card_is_one_frame_that_rings_for_its_thread checks "no
tint" as the thread painting no ground rather than painting paper.

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

While a margin card grows with its reply field (Shift+Enter or a soft
wrap), box-motion draws the field's focus ring on the card's surface,
behind every part of the card. The field itself (`.lf-compose-field`)
paints its own paper, and its layout already stands at its grown size,
so that paper covered the ring's edge on the side it grows toward until
the ring had nearly reached its rest: for the tween's first 2-5 frames
the ring showed its top and sides but no bottom.

On main the reply row's paper was clipped to its old outline while it
moved, which happened to clip the field's paper too and hid this. The
parent commit removes that paper (the ring's top edge was vanishing
under it), which exposes the field's own paper. So the surface now draws
the ringed part's ground as well as its ring: the ring's fill takes the
part's background colour, and the part stands transparent while it
moves, as the box itself already does over the surface's fill.

Measured in recordings of a soft wrap and of Shift+Enters, 25 fps,
counting frames with the ring's top edge but not its bottom:
Firefox: main 0, parent commit 8 and 11, this commit 0 and 0;
Chromium: main 0, parent commit 13 and 19, this commit 0 and 0.
The floating panel's field paints no ground, so it is unchanged.

test_a_growing_margin_reply_keeps_its_whole_ring_from_the_first_frame
holds the growth at its first frame and checks the ring's top and
bottom bands are drawn in its colour; without this change the bottom
band reads 0%.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty merged commit 29f45b3 into main Oct 27, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix-card-ring-bottom-cut branch October 27, 2026 07:21
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