Repository navigation
Settle the comments panel before measuring the label to press - #88
leaf-agent wants to merge 1 commit into
Conversation
|
Another occurrence: run 33154672429 (commit c4b7444) fails at the same assertion — |
Carry the one-line stabilization from #88 so the inherited navigation test observes the open panel after its transition completes.
78d5ec9 to
979bee8
Compare
|
Rebased onto current main ( The rebase is what this PR needed: its red So this is now the only thing keeping EvidenceTwo further occurrences since the last comment here, both naming the same assertion with the same diff (
On that last run Re-verified locally on the rebased tree, both directions from the same base ( Main's lint state at |
|
Superseded — closing. The identical one-line change is already on VerificationThis run was dispatched for run 33159578982 on 43ada1a, which failed at the same assertion this PR diagnosed —
|
…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]>
…ts seat (#2638) 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. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: leaf-agent <[email protected]>
Problem
tests/test_render_navigation.py::test_a_label_press_keeps_the_controls_keyboard_standingfails deterministically on main, and has failed on everycirun since the commit that added it (db1100e) — run 33153186163 and run 33153722537 both name it. It reproduces at-n0on this runner every time, so it is not contention and not a load-dependent race.The test's last stanza opens the comments panel, focuses a thread, and then measures
#frame-label spanto press it. The panel's class flips at once but the document slides into its new width over about a fifth of a second (syncLayout), so thebounding_box()read lands mid-flight: it reportedx=200.6 width=66.5, and by the timemouse.down()dispatched, the span's own rect was164.8 → 231.4while the pointer sat at233.9— just past its right edge. The press therefore landed on the enclosinglf-optionrather than the label, nolabel.controlappeared in thecomposedPath(), the runtime never opened a label transaction, and the thread lost its standing. That is the assertion's exact diff:⏎ / replywherec / commentswas painted.Solution
Call the existing
panel_settled(page)after opening the panel, which the same file already does at four other sites and whichrender_harness.pydocuments for precisely this read. It waits for the class to reachopenand fordocument.body.getAnimations()to drain, so the geometry read is of the layout the press will meet. The behaviour under test is untouched — with the press landing on the label, the label transaction holds the thread's standing and the assertion passes on its own terms.Testing
-n0, three consecutive runs: passed each time (failed before the change on the same commit).uv run pytest tests/test_render_navigation.py --run-nightly: 51 passed.uv run pytest tests: 648 passed, 6 skipped.Automated fix for failed run