Skip to content

fix: keep a reply carried from a margin card back to its diff seat focused - #7583

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

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

When a patch gives a thread back to its seat on a diff line while the user is typing in its margin card, the reply editor on the diff line is now focused again, as #7563's parent left it. The focus is on the same editor, with the same caret and undo history.

Cause. #7563 made the margin render follow a card's thread when the thread leaves the card's row (followCardThread in margin-projection.js). The first render after the patch still finds the thread in a margin row, because lf-diff hasn't seated it yet. followCardThread then reopened the card there, which moved focus from the reply editor to the card's frame. The thread pass was carrying the user's place on that editor (records/thread/focus.js, carryingThreadPlace), and the focus move broke the carry. On the next render the thread had its seat, so the card closed and the default letGo() sent the user to the page body. Logging on main showed this sequence: carryingThreadPlace was true at the first followCardThread, and false once the reopen had focused the card's frame.

Change. While the thread pass is carrying the user, followCardThread only closes the card, which places no one, and the pass lands the user where the thread now stands. Resolved and withdrawn threads take the same path as before.

What it keeps from #7563. I checked the case #7563 targets: a revision moves a card's thread to another margin row while the user types in the card's reply. On both base and head the user stays in the card's reply with their words. #7563's own resolve and revision tests still pass.

Verification. Both tests named in #7580 failed on main and pass with the change:

  • 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

These also pass:

  • test_a_reply_box_left_by_tab_returns_to_the_diff_with_its_history
  • test_resolve_in_a_card_moves_on_across_the_passages_of_its_target and test_resolve_in_a_card_moves_on_to_the_next_thread_at_its_passage
  • test_a_card_quotes_the_words_a_revision_rewrote_under_its_head_line and test_a_card_open_across_a_revision_opens_where_its_passage_stands
  • test_a_reflow_that_moves_a_marker_carries_its_open_card
  • pnpm run test:runtime and check:browser

This is one more place that decides around a carried focus. #7564 tracks the structural fix, one owner moving focus per reading.

Closes #7580 — automated triage

…cused

#7563 made a render follow a margin card's thread when the thread leaves
the card's row (`followCardThread`). When a patch gives the thread back to
its seat on a diff line, the first render after the patch still finds the
thread in a margin row, because the diff hasn't seated it yet. That render
reopened the card in that row, which moved focus from the reply editor to
the card's frame. The thread pass was carrying the user's place on that
editor (records/thread/focus.js, `carryingThreadPlace`), so the move broke
the carry. The next render found the seat, closed the card and let the
user go to the page.

While the thread pass is carrying the user, `followCardThread` now only
closes the card, which places no one, and the pass lands the user where
the thread stands. A card whose thread a revision moves to another margin
row, with the user typing in its reply, still keeps them in the card's
reply with their words, as before.

Tests: test_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_back
and test_a_reply_dictated_on_the_diff_keeps_listening_as_its_thread_moves
failed on main and pass. #7563's resolve and revision tests, the seated
left-by-tab test and pnpm run test:runtime also pass.

Closes #7580
@leaf-agent
leaf-agent merged commit d0524e3 into main Nov 29, 2026
8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7580 branch November 29, 2026 02:39
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_seated_threads: a reply editor loses focus when its thread returns from the margin card to the diff (since #7563)

1 participant