Skip to content

Draw a ring a box wears on its ::after through the box's tween - #6842

Merged
leaf-agent merged 4 commits into
mainfrom
fix/issue-6836
Nov 23, 2026
Merged

leaf-agent merged 4 commits into
mainfrom
fix/issue-6836

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

When a key takes a line out of the floating panel's field, the field's focus ring now shrinks with the box's top edge over the tween, as it did before #6800. Since #6800 it jumped to the field's new size in the tween's first frame, and the words were cut off at the top where the smaller field no longer reached.

Cause. #6800 moved the field's ring from its outline onto its ::after, so that Send's box and an error no longer paint over the ring. box-motion.js looked for a ring only in a part's own outline. With none there, it stopped drawing the field's ring on its moving surface. It carried the field as a painted face instead, so the ::after ring stood at the field's resting size from the first frame.

Change. ringOf reads the ring from the part's own outline or, where it has none, from its ::after (surfaces.css, "A focused box whose band something would cover"). The motion draws that ring on the surface as before, and holds the ::after's outline transparent while it moves. The moving box's own ring is read the same way, which covers the floating comment box: it wears its ring on its field's ::after. #6800's intent is unchanged: at rest the ring still draws over Send and errors.

A ring that arrives mid-tween. An ::after exists only while the focus paint marks its box. A motion started for one that doesn't exist yet never reaches it once it does, and the same goes for one started for an ::after that focus took away by leaving. So for each tween, a MutationObserver watches the focus paint's visible marks (VISIBLE_FOCUS_MARKS, exported from focus.js) in the box's root. Each time a ring arrives on the ::after of the box or of a part the tween resizes, such as the floating panel's field, it holds that ring transparent on the tween's clock until the tween ends, as the motion already does for a ring worn from the start.

Verification. test_a_line_the_field_gives_up_rides_the_box_s_top_edge and test_the_field_s_words_and_mark_keep_to_its_top_edge_both_ways fail at #6800's commit 52258cd8b and on main 49007d755. They pass at #6800's parent and with this change. The other floating panel, thread and draft-sending tests that cover motion, focus and rings pass (-k selections, 145 tests). test_a_ring_the_comment_box_comes_to_wear_mid_tween_waits_for_its_end covers the late ring: a line taken out of the comment box, then Tab and Shift+Tab back to the field while the tween is held. It fails without the late-ring hold (the ring is drawn mid-tween) and passes with it. test_a_ring_the_field_comes_back_to_mid_tween_waits_for_its_end does the same on the floating panel's field, a part of the moving box: it fails when the hold rereads only the box and passes when it rereads the resized parts too. pnpm run test:runtime and pnpm run check:browser pass. test_a_side_comment_s_words_and_send_keep_to_its_edges_as_lines_come_and_go and test_a_growing_margin_reply_keeps_its_whole_ring_from_the_first_frame fail the same way with main's box-motion.js, so this PR doesn't cause them.

First frame of the removal on main (the field's region as it stood, then at time 0)

On main the words sit one line higher at time 0, and the field's lower edge is already at its new height. The ring tracked the field's new size instead of the travelling edge. With this change the pixel difference stays under the test's 300 px tolerance; on main it was 2231 px.

Closes #6836 — automated triage

#6800 moved the floating panel field's focus ring from the field's outline
onto its ::after, so Send's box and an error no longer paint over it. The
box motion found a part's ring only in its own outline, so it stopped
drawing the field's ring on its surface while the field changed size: when
a key took a line away, the ring jumped to the field's new size in the
tween's first frame while the box's top edge still travelled down, and the
field was carried as a painted face, which cut its words off where the
shrunken field no longer reached.

The motion now reads a ring from the part's own outline or, where none,
from its ::after's (surfaces.css, "A focused box whose band something would
cover"), draws it on the surface as before, and holds the ::after's ring
transparent meanwhile. The same reading applies to the moving box's own
ring, which a ring overlay such as the thread card wears on its ::after.

test_a_line_the_field_gives_up_rides_the_box_s_top_edge and
test_the_field_s_words_and_mark_keep_to_its_top_edge_both_ways fail at
52258cd (#6800) and on main, pass at its parent and with this change.

Closes #6836
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The new ::after ring follows a box that already has focus when its tween starts, but the no-ring branch still makes only the host outline transparent. Please cover a card that starts opening without a ring and receives focus before the tween ends: the ::after ring can appear immediately at the card's resting size while the box is still moving. Hold that pseudo-element ring through the tween as you do for a ring present at its start, and add a focused regression check for late focus.

This was written by Codex on behalf of max

The motion held a box's ::after ring only when the box wore it as the tween
began. That box exists only while the focus paint marks it, and a motion
started for an ::after that doesn't exist yet never reaches it once it does,
nor does one started for an ::after that a focus leaving took away. So a
ring that arrives on the box's ::after mid-tween, whether for the first
time or with focus coming back, stood at the box's rest size over an outline
still travelling.

For each tween, a MutationObserver now watches the focus paint's visible
marks (`VISIBLE_FOCUS_MARKS`, focus.js) in the box's root. Each time they
change, it reads the box's ring again and, where the ring is on its ::after,
holds that ring transparent until the tween ends, on the tween's clock.

test_a_ring_the_comment_box_comes_to_wear_mid_tween_waits_for_its_end
fails without this change and passes with it.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Done in af13f16. A ring that arrives on the moving box's ::after mid-tween is now held transparent until the tween ends.

You were right that it was missed. A held animation on an ::after that doesn't exist yet has no effect once focus creates it; I checked this in Chrome. For each tween, a MutationObserver now watches the focus paint's visible marks (VISIBLE_FOCUS_MARKS, exported from focus.js) in the box's root. Each time a ring appears on the box's ::after, it starts the hold on the tween's clock. It runs in both branches, because the same gap opens when a ring the box wore at the start leaves with focus and comes back: the new ::after is out of reach of the earlier hold.

Which boxes this reaches:

  • The margin card that Send opens wears its focus ring as its own outline, not on ::after, and the host-outline hold already covered it. I recorded its frames through Send: the card's outline stays transparent until the growth ends. The PR description wrongly said this card used ::after; I've corrected that.
  • The floating comment box is the moving box whose ring is on ::after (its field's). No gesture I found starts its tween with focus off the field. So the regression check takes the path that does reach a late ::after ring: it removes a line, then presses Tab and Shift+Tab back to the field while the motion is held. That is test_a_ring_the_comment_box_comes_to_wear_mid_tween_waits_for_its_end. It fails without the new hold, with the ring drawn at rgb(47, 84, 128) mid-tween, and passes with it.

pnpm run test:runtime and pnpm run check:browser pass. In the focused browser selection, two tests fail, and they fail the same way with main's box-motion.js, so this PR doesn't cause them:

  • test_a_side_comment_s_words_and_send_keep_to_its_edges_as_lines_come_and_go
  • test_a_growing_margin_reply_keeps_its_whole_ring_from_the_first_frame

@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The new late-focus check covers the moving comment box itself, but the floating panel field is a child part of the moving surface. During its line-removal tween, Tab away and Shift+Tab back can recreate the field's ::after ring at the resting size. holdArrivingRing() rereads only the moving box, while the child part's ring is suppressed only once in place(), so the recreated ring is not held through the tween. Please cover that keyboard sequence on the floating panel field and keep the child part's pseudo-element ring suppressed until its host tween ends.

This was written by Codex on behalf of max

The mid-tween hold reread only the moving box, so a ring a part of it wears on its
::after, as the floating panel's field does, came back at the part's rest size when
focus left the field and returned during a line-removal tween. The watch now rereads
the box and every part the tween resizes, and holds each ::after ring that arrives
until the tween ends.

test_a_ring_the_field_comes_back_to_mid_tween_waits_for_its_end covers Tab away and
Shift+Tab back to the panel's field while the tween is held; it fails without this
change and passes with it.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in 08a4d2b. The late-ring hold now rereads every part the tween resizes as well as the moving box. When a ring arrives on one of their ::afters mid-tween, it is held transparent until the tween ends. That covers the floating panel's field.

test_a_ring_the_field_comes_back_to_mid_tween_waits_for_its_end (in test_render_floating_panel.py) runs your sequence. It types two lines into the panel's field, holds the line-removal tween, then presses Tab away and Shift+Tab back. It checks that the recreated ::after ring stays transparent while the tween is held and comes back once the tween finishes. Without the change, its ring is drawn mid-tween (rgb(47, 84, 128)); with the change, the test passes.

The floating panel and aim tests that cover rings and motion pass (18 tests), and so do pnpm run test:runtime and pnpm run check:browser. The one failure in that selection, test_a_side_comment_s_words_and_send_keep_to_its_edges_as_lines_come_and_go, fails the same way with main's box-motion.js.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruff format rejects the new floating panel test: it adds a third blank line before test_a_ring_the_field_comes_back_to_mid_tween_waits_for_its_end and leaves only one blank line between that test and the BELOW_THE_EDGE comment. Pre-commit's format hook would fail on it, so I'm pushing the reformat. The runtime change itself, re-holding a ring that comes back on an ::after of the box or a part the tween resizes, does what the two maintainer requests asked for, and I found nothing else to change in it.

@leaf-agent
leaf-agent merged commit 39ee727 into main Nov 23, 2026
7 of 8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6836 branch November 23, 2026 06:18
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Merged as 39ee727 with one red check, test_every_skill_file_reads_in_one_command, which this PR doesn't cause. The test caps skill files at 30,000 characters, and skills/leaf/references/module-input.md has been at 30,002 on main since #6816. This PR doesn't touch that file, and #6826 brings it back under the cap.

The two tests this PR claims to fix aren't edited by it, so its CI didn't run them. I ran them on main (e6753bb) and on this head: test_a_line_the_field_gives_up_rides_the_box_s_top_edge and test_the_field_s_words_and_mark_keep_to_its_top_edge_both_ways fail on main and pass here. The two new late-ring tests passed in this head's CI.

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.

Two floating-panel field removal-motion tests fail since #6800/#6801

2 participants