Skip to content

fix: land Show on page in a widget's thread seat on a phone - #5415

Merged
max-sixty merged 1 commit into
mainfrom
fix/show-on-page-seat-on-phone
Nov 5, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/show-on-page-seat-on-phone

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

On a phone-width window, Show on page for a thread seated in a widget now lands in that seat, as it does on a wide window. Before this change, Show on page for a thread on a line in a collapsed lf-diff file left focus on body with nothing traced. The maintainer chose this repair in #5343: one rule at every width, since the seat is where the thread stands on the page.

Cause. #5039 sends a phone's Show on page through the page-only route (reader: "page" in browser/runtime/thread/destination.js). Because the file was not loaded yet, the page drew no view of the thread, so the route picked the margin marker at the file's disclosure as its landing. Only then did it bring the place into view, which loads the file. The loaded file draws the diff's seat for the thread, which replaces that marker, and focus fell to body. The route now checks again once the place is in view. If the page now draws the thread, it lands there the same way a surface already shown is reached, and the panel puts its view away. If the page still draws no view, the marker or place landing from #5039 is unchanged.

Behavior changed. On a phone, Show on page for a thread in a widget seat lands in the seat (its reply box), not on a marker or on body. Show on page for a thread on a passage, which has no seat, still lands on its marker.

Verification.

  • tests/browser/test_render_anchors.py::test_a_deferred_diff_renders_only_opened_files_and_hydrates_comment_travel[keyboard-False] failed on main at 1b3e077 (timeout waiting for focus in .lf-diff-thread-outlet .lf-page-thread). It passes with this change, along with the [mouse-False] and [mouse-True] cases.
  • The Show on page, phone and seat tests in margin/test_opening_threads.py, threads/test_seated_threads.py, test_render_floating_panel.py and test_render_anchors.py pass (62 tests), including test_show_on_page_on_a_phone_lands_on_the_thread_s_marker.
  • pnpm run check:browser, pnpm run test:browser and pnpm run test:runtime (812) pass.

Closes #5343

On a window with no room for the rail, Show on page for a thread on a line in a
collapsed lf-diff file chose its landing, the margin marker at the file's
disclosure, before bringing the place into view. Loading the file draws the
diff's seat for the thread, which replaces that marker, so focus fell to body
with nothing traced. Show on page now checks again once the place is in view,
and where the page now draws the thread, as a seat, lands in it, as on a wide
window. The maintainer chose this in #5343: one rule at every width, since the
seat is where the thread stands on the page.

Behavior changed: on a phone, Show on page for a thread in a widget seat lands
in the seat, not on the marker or body. #5039 introduced the phone route.

Closes #5343
@max-sixty
max-sixty merged commit 3adac46 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/show-on-page-seat-on-phone branch November 5, 2026 06:57
max-sixty added a commit that referenced this pull request Nov 5, 2026
…ettlement on every surface (#5427)

A thread drawn in a seat that an `x-thread-seat` widget keeps now opens
in that seat when the user walks to it or takes back a settlement. One
test now covers every surface a thread can be resolved or reopened on,
against every way of undoing or refusing that, and checks which surface
shows the thread and where focus stands.

## What the user sees change

- Resolve a thread in a seat, scroll away and press `z`: the first press
shows the seat with the thread focused, and the second takes the Resolve
back there. Before, the thread opened in the floating panel, then in a
margin card.
- `t` or Shift+`t` to a seated thread lands on it in the seat and opens
no card. Before, a margin card opened beside the element showing the
same thread.
- A walk to a resolved seated thread opens the seat's Resolved
disclosure before it lands.
- A walk to a seated thread brings in the whole element when it fits the
window. Where the seat makes the element taller than the window, the
walk leaves the thread in view. Before, the landing on the element could
scroll the thread back out.

A reviewer reading the code found one more effect of the shared lookup,
which no test here checks: from an open thread's subject, `r` now
settles its seated thread and `c` enters its reply.

## How

- `pageSeatThread` (`thread/inline.js`) names the card a page-owned seat
draws for a thread. `surfaceFocusTarget` falls back to it after the
widget outlets, so every route that asks for a surface finds the seat,
and the margin's `seatedOnPage` calls it instead of repeating the query.
- `destination.js` opens the disclosure holding a drawing before
travelling to it.
- `scrollToThread` (`anchor-travel.js`) skips the landing on the
thread's place when the focused part stands inside a place taller than
its room (`fitsWhole`).

## The test


`test_every_way_back_from_a_settlement_returns_the_user_where_they_made_it`
crosses four surfaces (margin card, floating panel, seat, package
reader) with Resolve and Reopen and five ways back: `z` right after the
settlement's landing, `z` with the thread in view, `z` that shows first
and takes on the second press, the notice's Undo, and the server
refusing. Of the 40 cells, 31 run. These 9 have no route:

- Reopen in a card (5): no card draws a resolved thread.
- Reopen then `z` right after landing, in the panel, seat and reader
(3): the caret stands in the reply box, so `z` is a typed letter.
- Reopen then the notice's Undo in the panel (1): the panel's field
keeps the notice out of sight while it holds the caret.

The test replaces five tests of single cells:
`test_z_puts_the_user_back_in_the_thread_they_resolved`,
`test_z_leaves_the_user_in_a_seated_thread_they_resolved`,
`test_z_shows_a_settlement_the_user_left_before_taking_it`,
`test_a_thread_resolved_in_the_panel_comes_back_to_the_panel` and
`test_z_shows_a_thread_resolved_in_its_card_by_its_passage`.

`package_workspace` moves to `render_cases_interaction.py`, so the test
reaches it without importing another test module; the move changes
nothing else.
`test_primary_package_reader_retains_native_widgets_drafts_and_creation`
now expects "0 waiting on me", since #5331 removed the to-do it counted.

## Left as it is

On a page with both a seat and a package reader that accepts the thread,
undoing a Resolve made in the seat returns the user to the reader,
because the route asks the reader first. A reviewer found this by
reading the code, and it has not been run. Pages with both are rare, so
this change leaves it.

A seated thread keeps its margin marker, whose card draws the same
thread beside the seat. A Resolve made in that card now comes back in
the seat rather than the card, because a route to the page finds the
seat first, as Show on page does since #5415. The underlying fix is for
a seat to claim its threads as a widget outlet does, which leaves one
drawing per thread. It would also take the marker away from a seated
thread, so it waits on a decision.

## Testing

The type check, the runtime tests, the test above,
`test_a_walk_lands_on_a_thread_in_its_seat_in_view`, the package tests
and the Show on page tests pass locally. The browser tests ran in
Chromium, with no narrow window and no touch input. The test's longest
case takes 4.4 s on a loaded host. A separate reviewer used the seat
journeys on a live page in Firefox and Chromium, before the commit that
lands a fitting element whole.


`test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[replied-browser]`
fails locally at teardown, on the shift watch's `leaf-text.lf-ui moved
without input by (0, 138)px`. It fails the same way with main's versions
of the runtime files this change edits, so it is inherited.

> _This was written by Claude Code on behalf of max-sixty_
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.

Show on page on a phone leaves focus on body for a thread seated in a diff

2 participants