Skip to content

Place the reaction trigger beneath the panel in its browser test - #2625

Merged
leaf-agent merged 1 commit into
mainfrom
fix/ci-38275653575
Oct 12, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/ci-38275653575

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The main CI run failed because test_a_reaction_list_opens_from_a_trigger_under_the_thread_panel assumed a reply would remain in the viewport after a resize. #2562 intentionally preserves the page's reading position across width changes; at the failed assertion, the reaction trigger was above the viewport, so the panel could not cover it. The test now places the trigger under the panel before checking that e opens its reaction list and keeps it open.

The original test passes on the commit before #2562 and fails on #2562. The corrected test passes on this branch with uv run pytest -q -n0 tests/browser/test_render_threads.py::test_a_reaction_list_opens_from_a_trigger_under_the_thread_panel. No runtime behavior changes.

@leaf-agent
leaf-agent merged commit 585b61e into main Oct 12, 2026
2 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-38275653575 branch October 12, 2026 17:52
leaf-agent added a commit that referenced this pull request Oct 12, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/38283138365) failed
because the Threads naming test asks Playwright to see the dialog
envelope itself. [#2613](#2613)
intentionally made that transparent envelope zero size so it no longer
covers page text. The test now checks that the named dialog is open and
that its visible Threads panel is shown. It still checks the thread
card's accessible name after opening a comment.

The run's other failure, the reaction trigger placement test, was
addressed by merged
[#2625](#2625). Both focused tests
pass on this branch: `uv run pytest -q -n0
tests/browser/test_render_navigation.py::test_the_thread_panel_and_a_page_thread_carry_names
tests/browser/test_render_threads.py::test_a_reaction_list_opens_from_a_trigger_under_the_thread_panel`
(the original naming assertion failed before this change). This PR
changes only the test's reading of the panel.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…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]>
max-sixty added a commit that referenced this pull request Oct 14, 2026
…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]>
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.

1 participant