Skip to content

Draw a focused card message's ring over its sticky head, and read rings off the screenshot where hit testing sees nothing - #4556

Merged
max-sixty merged 5 commits into
mainfrom
anchored-thread-box
Oct 28, 2026
Merged

max-sixty merged 5 commits into
mainfrom
anchored-thread-box

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Next on me focuses the agent reply it lands on. In a margin card, that message's focus outline lost its top: an outline paints with its element's own content, so the card's sticky message head, the head's cell in the actions' track and the paper the head casts upward over the room (a box-shadow) all painted over it. The user saw a lidless box: two sides plus a stretch of top over the actions' track. This reproduces on main in Firefox and Chromium. Only the card has sticky message heads, so the panel and page threads were unaffected.

The fix (browser/runtime/annotation-overlay/annotation-chrome.css): a focused card message draws its ring on a positioned ::after at the head's z-index, so it wins by tree order. A page thread already does this. The transcript's mask keeps the lift inside the transcript.

The ring reading (tests/page_scripts/focus_rings.js, tests/render_cases_layout.py): rings_drawn passed the broken ring. It finds covers by hit testing, and a box shadow takes no hits. It now also samples each run of the layer's own rings wherever nothing in front takes hits, reads those points off one screenshot clipped to them, and reports a run the ring's colour misses among covers. Every ring_faults caller gets the check. Three things support it:

  • The ring's ink resolves to sRGB through a canvas.
  • Rounded corners are skipped.
  • Points under pointer-events:none chrome or outside the ring's clipping bands are left out.

All 30 existing browser tests that read rings pass. One of them, test_what_an_outer_column_draws_outside_itself_stays_whole, read rings before the page had rendered after a focus move, so it now waits for the render.

Tests:

  • test_a_reply_next_on_me_lands_on_wears_its_whole_ring_in_its_card fails on the old rule ("its top edge shows the ring at 0% of its 24 samples").
  • A new leaf-dev stills state, ship-card-message-keyboard, captures the landing.

What's left:

  • The daily corpus Tab walk (tests/journeys/test_render_controls.py) now runs the pixel reading at every stop. That adds a clipped screenshot per stop, and could surface rings it couldn't see before.
  • Two other cases are known and not fixed here:
    • In Firefox, a subgrid scroller leaves its end padding out of its scroll area, so a focused last message's bottom run is cut at the transcript's end. Moving the room to a row breaks scrollLimit, which reads paddingBottom.
    • A summary head 8px below a focused message would likely cover its bottom run the same way. This is inferred from the CSS and wasn't run.

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

max-sixty and others added 5 commits October 27, 2026 21:56
Next on me lands focus on the agent's reply it waits on, and in a margin card that
message wore the generic focus outline. An outline paints with its element's in-flow
content, so the message's sticky head, the head's cell in the actions' track and the
paper the head lays over the room above it all painted over the ring: the user saw
the ring's sides and, over the actions' track, a corner of its top, a box with its
lid torn off. It reproduces on main in Firefox and Chromium.

The ring now sits on a pseudo-element over the message, after the head in tree
order, as a thread's ring already does, so it shows whole.

A new browser test lands on such a reply with Next on me and reads the ring's top and
left runs off the pixels; it fails on the old rule (top run 0% drawn). The ring
reading (`rings_drawn`) passed the broken ring, since it hit-tests and a box shadow
takes no hits. A `leaf-dev stills` state, ship-card-message-keyboard, covers the
landing.

Co-Authored-By: Claude <[email protected]>
`rings_drawn` found what covers a ring by hit testing, so paint that takes no hits
passed: a box shadow, a pseudo-element or layer with no pointer events, or a ring
never painted. A margin card's sticky message head lays its paper over the room above
it as a shadow, and the ring on the message under it read whole with its top run
gone (ea8734c fixed that ring).

`ringsDrawn` now also returns, for each of the layer's rings, sample points along
each run on screen where nothing in front takes hits, and `rings_drawn` reads them
off one screenshot. A run the ring's colour misses at three or more samples and over
a tenth of them is reported among `covers`. Every caller of `ring_faults` gains the
check; the card test drops its own pixel reading.

The screenshot takes a frame, which exposed
`test_what_an_outer_column_draws_outside_itself_stays_whole` reading rings while the
target painter's mark still followed the previous link; it now waits for the page to
render after each focus.

Co-Authored-By: Claude <[email protected]>
… show the landed ring in its still

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 92524ed into main Oct 28, 2026
4 checks passed
@max-sixty
max-sixty deleted the anchored-thread-box branch October 28, 2026 05:47
max-sixty added a commit that referenced this pull request Oct 28, 2026
…4558)

Next on me focuses the agent reply it lands on. In a margin card, #4556
drew that message its own whole ring over its sticky head. The card
already wears the ring when its thread has focus ("the card is the
thread's one frame"), so a message ring inside it made a frame in a
frame, and the user asked for the card to wear it instead.

**The change**
(`browser/runtime/annotation-overlay/annotation-chrome.css`): the card's
ring rule also matches a card whose thread holds a focused message, and
a focused card message draws no ring of its own. This removes #4556's
positioned `::after` ring. Only the card builds `.lf-margin-thread`, so
messages in the panel and in page threads keep their own ring.

**Tests:** `test_a_reply_next_on_me_lands_on_rings_its_card`
(`tests/browser/margin/test_card_reply.py`) presses `m` onto a long
reply in a card and expects the focused message, the card as the only
ring worn, and no ring faults, which includes the pixel reading #4556
added. The `ship-card-message-keyboard` still's docstring now describes
the card's ring.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Oct 28, 2026
… it can't colour (#4565)

One run of the daily corpus ring sweep
(`test_each_sampled_focus_ring_is_shown_whole_in_its_surface`) with
#4556's screenshot reading found no ring a user sees broken. Before it
got that far, it stopped on four faults in the tests. Three of them fail
the next scheduled run.

**Faults in the readers and fixtures**

- **macOS StopIteration in `_read_ring_boxes` (#4432):** the probe
stashed the projected focus mark (`.lf-visual-mark-focus`), and the
runtime replaced it before the CDP read, leaving a detached node with no
`::after` styles. Instrumenting the read confirmed it: `connected:
false`, `pseudoElements: []`. `rings_drawn` now waits for `rendered`
before reading, and so does the Tab walk after each Tab. The per-test
wait #4556 added to the table test is removed.
- **Resolved threads:** #4538 folds them under Threads' Resolved
heading, so `open_panel_thread_holding` never found one. It now unfolds
them (`show_resolved`).
- **`test_rings.py` fixture widget:** it still passed `offerAction` the
`icon` option that #4547 renamed to `action`, so its page failed to load
and four tests errored.
- **Landed diff line:** it was read while `]`'s landing still scrolled
the page smoothly. `page_at_rest` doesn't wait for that, because
`moving()` counts only Web Animations, so this scope now waits with
`scroll_settled`.

**The pixel reading's six findings, each whole on screen**

The reading now leaves to the hit-test reading any ring whose colour it
can't predict:

- a ring faded with its box (two disabled controls at 0.55 opacity);
- a ring in a scaled box (a film's terminal in an SVG `foreignObject`,
whose 1.5px band blends with its ground);
- an inline box split over lines, where each fragment wears its own
ring.

It also skips points where a button or link of the box's own stands in
front, as a draft's toolbar seated on its top border does. Ring geometry
now scales a scaled box's band and offset.

**Checks**

- Restoring the card message's own outline still fails "its top edge
shows the ring at 0% of its 24 samples".
- The sweep, `test_rings.py` (Chromium and Firefox),
`test_card_reply.py` and the table ring test pass locally: 72 tests.

Closes #4432

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude <[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