Repository navigation
fix: keep a reply carried from a margin card back to its diff seat focused - #7583
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (
followCardThreadinmargin-projection.js). The first render after the patch still finds the thread in a margin row, becauself-diffhasn't seated it yet.followCardThreadthen 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 defaultletGo()sent the user to the page body. Logging onmainshowed this sequence:carryingThreadPlacewas true at the firstfollowCardThread, and false once the reopen had focused the card's frame.Change. While the thread pass is carrying the user,
followCardThreadonly 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
mainand pass with the change:test_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_backtest_a_reply_dictated_on_the_diff_keeps_listening_as_its_thread_movesThese also pass:
test_a_reply_box_left_by_tab_returns_to_the_diff_with_its_historytest_resolve_in_a_card_moves_on_across_the_passages_of_its_targetandtest_resolve_in_a_card_moves_on_to_the_next_thread_at_its_passagetest_a_card_quotes_the_words_a_revision_rewrote_under_its_head_lineandtest_a_card_open_across_a_revision_opens_where_its_passage_standstest_a_reflow_that_moves_a_marker_carries_its_open_cardpnpm run test:runtimeandcheck:browserThis 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