Repository navigation
Take the user along when a thread moves between its margin card and its seat - #2638
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
An active reply dictation session still ends when its thread moves between the diff and the margin card.
…ts seat Item #88 of the Lit follow-up review (the review numbers its own items; #88 is not a GitHub issue). #2614 took a reply being written in the margin card back to the diff line with its thread. It left four cases where the card closes before the thread's new place exists or is chosen. This PR settles all four. ## The rule A thread moving between surfaces takes the user standing on it along: - **The reply editor belongs to the editing session, not to the view showing it.** A view that can no longer draw the thread releases the editor row (`releaseReplies`, `thread/replies.js`). That covers a seat the thread left, and the margin card, open or closed, once its thread has left the margin (`releaseLeft`, `thread-preview.js`). - The row goes to a view that draws the thread now. Where none does yet, it waits in a hidden park in the chrome. - The next view to draw the thread claims the row in the same task, in place of its own (`claim`): a seat once it stands in the document, the margin card once it places its thread, or a visible Threads card. - The editor moves with `moveBefore`, so focus, caret, IME state and undo history stay, and no blur fires. Leaf's dictation stays with the row too: a view handing its row on (`give`) no longer stops it, and a seat releases a leaving thread's row before retiring the rest of its card. - A closed card whose thread is still in the margin keeps its row, as a hidden Threads panel does, since the user goes on there when it opens again. - **A user standing anywhere else on the thread goes with it** (`holdThreadPlace`, `thread/focus.js`, generalizing #2614's `holdReply`). "Anywhere else" means a margin card's controls, a seat's controls, or the thread's margin marker (`entryThread`, `margin-projection.js`). - When the pass takes away the node they stood on, they land on the thread itself where the pass seated it. - They hold no words that need showing, so the pass opens no card or panel for them. - It does nothing for a resolved thread, nor once another owner has placed them or they have acted. - A reply control names its thread from its own session (`replyThreadKey`), so a parked row still names its thread. ## #88 A: the editor no longer blurs on a move **What changed.** The editor keeps focus as it moves from the diff line to the margin card or Threads, and back. Before, it blurred once on each move, which cancelled an IME composition in progress and announced a focus change, and the move stopped Leaf's dictation, so the next words heard went nowhere. - Card → diff: the margin releases the row into the diff line's new seat as its thread leaves the margin, before the card hides. - Diff → card: the seat releases the row to the park, and the card claims it as it opens, in the same task. - `holdBox` (`reply-landing.js`) no longer scrolls the page to hold a control that left its thread view. ## #88 B: leaving the card first keeps the editor **What changed.** A user who left the card's reply before the patch returned gets the same editor on the diff line, undo history included. That holds whether they Tabbed onto the margin or closed the card. Before, the diff line drew a fresh editor with only the words, and the hidden card kept the original. ## #88 C: the card's Close **What changed.** A user on the card's Close when the thread returns to the diff lands on the thread on the diff line. Before, they landed on the banner's More button. ## #88 D: the margin marker **What changed.** A user on the thread's margin marker when the thread returns lands on the thread on the diff line. Before, they dropped to the page body. ## Tests These failed on `main` and pass now: - `test_a_reply_dictated_on_the_diff_keeps_listening_as_its_thread_moves` replaces the browser's speech recognizer at its boundary, as `tests/runtime/dictation.test.mjs` does. It dictates on the diff line, moves the thread to the card and back, and expects the heard words in the same box each time with the recognizer never aborted. - `test_a_reply_box_whose_thread_leaves_the_diff_takes_the_user_to_its_card` (overlay, resolved, page margins) and `test_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_back` now count blur events on the editor and expect none. On `main` each counted one. - `test_a_reply_box_left_by_tab_returns_to_the_diff_with_its_history[open|closed]` (B) failed at the undo. - `test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[close|marker]` (C, D) failed with focus on the banner, and on the body. `test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_owner` now finds the focused editor with `:focus` instead of `:focus-within`. Chromium leaves an element moved through a `display: none` parent unmatched by its own native `:focus-within`, while its new ancestors still match. No Leaf style reads that pseudo-class; focus paints through `data-lf-focus-within`. The gap is recorded in `notes/browser-support.md`. ## Lines Hand-written source: +250 / −67. - `replies.js` +95/−21 - `focus.js` +74/−33 - `inline.js` +21/−1 - `margin-projection.js` +16/−4 - `thread-preview.js` +16/−1 - `presentation.js` +10/−5 - `thread-card.js` +6 - `reply-landing.js` +5/−2 - `thread-list-view.js` +4 - `application.js` +3 Tests: +155 / −1. ## Checks - The related browser selection passes: 881 tests across the thread, draft, widget, anchor, read-state, file, diff-control, margin, words-watch, response-continuity and response-pointer files. Three failed, and they fail on the base commit too: `test_observed_scroll_retains_the_seat_of_a_constrained_target` ×2, and `test_a_reaction_list_opens_from_a_trigger_under_the_thread_panel`, which #2625 has since fixed on `main`. - `pnpm run test:runtime` and pre-commit pass on the changed files. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2165a14 to
1b64b22
Compare
|
@leaf-agent Please refresh this PR branch against current main and resolve its mechanical merge conflicts so it can get current CI. Preserve the proposed behavior and the current draft state, run the focused checks for the resulting diff, and report any conflict that requires a semantic or product decision. This requests branch maintenance; the outstanding maintainer review remains pending.
|
# Conflicts: # skills/leaf/assets/runtime/annotation-overlay/margin-projection.js # skills/leaf/assets/runtime/thread/inline.js # skills/leaf/assets/runtime/thread/presentation.js # skills/leaf/assets/runtime/thread/replies.js
|
Refreshed this branch against Focused verification passed: |
leaf-agent
left a comment
There was a problem hiding this comment.
The author said the outstanding maintainer review remains pending, so I am withholding approval until that review is complete.
|
@leaf-agent No maintainer review is pending on this PR: the maintainer has chosen to land it. Please review the current head (
|
Item #88 of the Lit follow-up review (the review numbers its own items; #88 is not a GitHub issue). #2614 took a reply being written in the margin card back to the diff line with its thread. It left four cases where the card closes before the thread's new place exists or is chosen. This PR settles all four.
The rule
A thread moving between surfaces takes the user standing on it along:
releaseReplies,thread/replies.js). That covers a seat the thread left, and the margin card, open or closed, once its thread has left the margin (releaseLeft,thread-preview.js).claim): a seat once it stands in the document, the margin card once it places its thread, or a visible Threads card.moveBefore, so focus, caret, IME state and undo history stay, and no blur fires. Leaf's dictation stays with the row too: a view handing its row on (give) no longer stops it, and a seat releases a leaving thread's row before retiring the rest of its card.holdThreadPlace,thread/focus.js, generalizing Take the user back with their reply when a thread returns from the margin card to its outlet #2614'sholdReply). "Anywhere else" means a margin card's controls, a seat's controls, or the thread's margin marker (entryThread,margin-projection.js).replyThreadKey), so a parked row still names its thread.#88 A: the editor no longer blurs on a move
What changed. The editor keeps focus as it moves from the diff line to the margin card or Threads, and back. Before, it blurred once on each move, which cancelled an IME composition in progress and announced a focus change, and the move stopped Leaf's dictation, so the next words heard went nowhere.
holdBox(reply-landing.js) no longer scrolls the page to hold a control that left its thread view.#88 B: leaving the card first keeps the editor
What changed. A user who left the card's reply before the patch returned gets the same editor on the diff line, undo history included. That holds whether they Tabbed onto the margin or closed the card. Before, the diff line drew a fresh editor with only the words, and the hidden card kept the original.
#88 C: the card's Close
What changed. A user on the card's Close when the thread returns to the diff lands on the thread on the diff line. Before, they landed on the banner's More button.
#88 D: the margin marker
What changed. A user on the thread's margin marker when the thread returns lands on the thread on the diff line. Before, they dropped to the page body.
Tests
These failed on
mainand pass now:test_a_reply_dictated_on_the_diff_keeps_listening_as_its_thread_movesreplaces the browser's speech recognizer at its boundary, astests/runtime/dictation.test.mjsdoes. It dictates on the diff line, moves the thread to the card and back, and expects the heard words in the same box each time with the recognizer never aborted.test_a_reply_box_whose_thread_leaves_the_diff_takes_the_user_to_its_card(overlay, resolved, page margins) andtest_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_backnow count blur events on the editor and expect none. Onmaineach counted one.test_a_reply_box_left_by_tab_returns_to_the_diff_with_its_history[open|closed](B) failed at the undo.test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[close|marker](C, D) failed with focus on the banner, and on the body.test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_ownernow finds the focused editor with:focusinstead of:focus-within. Chromium leaves an element moved through adisplay: noneparent unmatched by its own native:focus-within, while its new ancestors still match. No Leaf style reads that pseudo-class; focus paints throughdata-lf-focus-within. The gap is recorded innotes/browser-support.md.Lines
Hand-written source: +250 / −67.
replies.js+95/−21focus.js+74/−33inline.js+21/−1margin-projection.js+16/−4thread-preview.js+16/−1presentation.js+10/−5thread-card.js+6reply-landing.js+5/−2thread-list-view.js+4application.js+3Tests: +155 / −1.
Checks
test_observed_scroll_retains_the_seat_of_a_constrained_target×2, andtest_a_reaction_list_opens_from_a_trigger_under_the_thread_panel, which Place the reaction trigger beneath the panel in its browser test #2625 has since fixed onmain.pnpm run test:runtimeand pre-commit pass on the changed files.