Skip to content

test_seated_threads: a reply editor loses focus when its thread returns from the margin card to the diff (since #7563) #7580

Done

Description

@leaf-agent

tests/browser/threads/test_seated_threads.py has two tests that fail on every run from #7563 (6e7004dbd) through current main (3cce8ff2c), and pass on its parent b67c5abf7:

  • test_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_back
  • test_a_reply_dictated_on_the_diff_keeps_listening_as_its_thread_moves

When the patch puts the thread back on its diff line, the margin card closes as the tests expect. But the reply editor on the diff line is not focused:

Expect "to_be_focused" locator("lf-diff .lf-page-thread[data-lf-thread=…]").locator(":scope > .lf-thread-reply leaf-text")
  locator resolved to <leaf-text name="reply" …>
  - unexpected value "inactive"

So the user's typing no longer follows the thread from its card back to its seat (records/thread/focus.js, carryingThreadPlace).

#7563 changed the render's handling of the selected card in margin-projection.js. It added followCardThread, whose seat branch calls closePreview() and returns true, and showNextAtTarget. Before that, the same render called closePreview() only when the card's entry had gone. The two orderings to check are where the default letGo() landing of closePreview now runs relative to the thread pass that carries focus to the seat, and whether openInlineThread(id, { card: true }) reopens the card for a thread that is on its way to a seat. This is a code reading I haven't confirmed.

Seen in run 46202905667 on 73e842a64. Reproduced locally on 3cce8ff2c with uv run pytest -n 3 -p no:randomly over the two node ids above. Bisected over 25f9d33f9..73e842a64 by running the tests at b67c5abf7 (pass) and 6e7004dbd (fail).

#7564 tracks the structural problem behind this class of focus bug: several pieces of code each move focus around one reading.

Cause of a failure tracked in #7579.

Activity

  1. added
    tend-ci-cause
    on Nov 29, 2026
  2. leaf-agent commented on Nov 29, 2026

    @leaf-agent
    CollaboratorAuthor

    #7583 fixes this. I've confirmed the cause the body guessed at: openInlineThread(id, { card: true }) reopens the card for a thread that is on its way to a seat.

    The first render after the patch still finds the thread in a margin row, because lf-diff hasn't seated it yet. followCardThread reopened the card there, which moved focus from the reply editor to the card's frame. That broke the thread pass's carry (carryingThreadPlace), so the next render's closePreview() sent the user to the page. With the fix, followCardThread only closes the card while the pass is carrying the user, and the pass lands them on the seat.

    Both tests fail on main (9e2e64d34) and pass on the PR's branch. #7563's resolve and revision tests and test:runtime still pass. tend-land owns the PR's CI and landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions