Skip to content

fix: drop a passage's hit-test pieces when its thread moves onto an element - #7584

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-7581
Nov 29, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-7581

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A press on a marked phrase, in the same task in which a script gave the phrase a second copy, opened the thread's card. Placement had already moved the thread onto its section, since the quote no longer picks out one copy. But the anchor paint's replace (browser/runtime/annotations/anchor-paint.ts) asked for a whole repaint for a thread that now stands on an element, and returned before it removed the passage's pieces from the hit-test index. The repaint runs later, so markHit still found the old mark under the press.

This defect is older than #7563. At #7563's parent b67c5abf7 the press also opened a card, as a probe that counted cards right after the click showed, but the next margin render closed it because its row was gone. Since #7563, followCardThread moves the card to the thread's new row, as that PR meant it to, so the card stayed open and test_a_press_in_the_task_a_script_repeats_a_marked_phrase_opens_nothing failed. Now replace drops the old pieces before it asks for the repaint, so the press finds no mark and opens nothing, which is what the test protects. #7563's card-following behavior is unchanged.

Verification: the test failed in [browser] and [firefox_browser] on main (9e2e64d34) and passes in both with this change. The press, script and quote tests in test_render_anchors.py (35), tests/browser/threads/test_resolving.py with tests/browser/margin/test_opening_threads.py (64), and pnpm run test:runtime all pass.

Closes #7581 — automated triage

…lement

When a script gives a marked phrase a second copy, placement re-places the
thread on its section, and the anchor paint's `replace` handed that thread to a
whole repaint before removing its old pieces from the hit-test index. The
repaint runs later, so a press in the same task still found the phrase's mark
and opened the thread's card. Before #7563 the next margin render closed that
card again; since #7563 the card follows the thread to its new row, so it
stayed open and test_a_press_in_the_task_a_script_repeats_a_marked_phrase_opens_nothing
failed. The index now drops the pieces before the repaint is asked for, so the
press finds no mark there, as the test expects.

Closes #7581
@leaf-agent
leaf-agent merged commit cbade44 into main Nov 29, 2026
8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7581 branch November 29, 2026 02:41
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.

test_a_press_in_the_task_a_script_repeats_a_marked_phrase_opens_nothing: an ambiguous quote's press opens a margin card (since #7563)

1 participant