Skip to content

Give "focus marks the user's place only while in view" one owner, and exclude stuck boxes - #2285

Merged
max-sixty merged 2 commits into
mainfrom
placement-design-review
Oct 10, 2026
Merged

max-sixty merged 2 commits into
mainfrom
placement-design-review

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

One rule decides whether the control a user stands on still marks where they are: it does only while it is in front of them. A user who scrolled away from the box they were typing in is reading something else, even though the box keeps focus. A reflow should hold what they see, and a landing should not pull them back to the box. holdBox (thread/reply-landing.js) and capturePlace (reading-place.js) each wrote that rule out on their own. focusedInView() in user-place.js, the module that holds the user's place, now states it once, and both call it.

The shared rule also fixes a case that both copies got wrong. A focused control inside a stuck sticky box is always in view but marks no place: a page tab strip stuck over the sixtieth paragraph, or an open thread's title over the turns below it. The box rides along with every scroll. Say the reader focused a tab and then scrolled with no other input, so focus is still the last thing that named their place. A revision then kept the strip still, since the strip stays in view by itself. It did not keep the paragraph still, so the paragraph moved by whatever the revision added above it. stuckBox() in geometry.js detects a stuck sticky box. It counts one as stuck when the box stands at its scroller's stick line, or has been pushed past it, and its holder's edge has scrolled beyond it. focusedInView excludes such a box. holdBox used to exempt a pinned reply row with a check of its own; a pinned reply row is a stuck box, so focusedInView now covers that case and the separate check is gone.

Left alone: two readers ask a different question of their own:

  • placeKeeper asks whether the item that focus or the pointer names begins in the scroller's band. That is an anchoring rule.
  • The Threads list's resize landing from Keep focused thread title visible after panel resize #1735 asks whether the focused title stands wholly where a landing would put it.

Testing:

  • test_a_revision_keeps_the_paragraph_under_a_focused_stuck_tab is new. It passes with this change. Without the stuck-box exclusion it fails: the paragraph moved from 217px to 418px.
  • The existing browser tests for each site pass: test_a_visible_focused_element_is_the_reading_place_until_the_reader_scrolls_away, test_a_focused_reading_surface_preserves_its_passage_on_reflow, test_live_revision_keeps_the_visible_semantic_reading, the three agent-turn tests for holdBox, and the two Threads-resize tests.
  • tests/runtime/user-place.test.mjs passes.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 10, 2026 12:55
… exclude stuck boxes

holdBox (thread/reply-landing.js) and capturePlace (reading-place.js) each restated
that a focused control counts as the user's place only while it is on screen.
focusedInView() in user-place.js now states it once and both call it.

The shared rule also excludes a focused control riding in a stuck sticky box
(stuckBox, geometry.js): a page tab strip stuck over the panel's paragraphs stays in
view over every scroll, so it names no place. Before, a revision restored the strip
instead of the paragraph being read and moved the reader by what it added above.
The new test test_a_revision_keeps_the_paragraph_under_a_focused_stuck_tab fails
without the exclusion (217px -> 418px). holdBox's separate pinned-reply-row exemption
is subsumed (a pinned row is a stuck box).

placeKeeper and the Threads list's resize landing (#1735) keep their own,
different tests: whether the named item begins in the band, and whether the title
stands wholly where a landing puts it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 8bff2b4 into main Oct 10, 2026
6 checks passed
@max-sixty
max-sixty deleted the placement-design-review branch October 10, 2026 20:56
max-sixty added a commit that referenced this pull request Oct 10, 2026
main's #2285 moved the in-view rule to user-place.js and dropped the
import the page's whole-control check still reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
#2310)

`replyPinned` (`thread/reply-landing.js`) measured on its own whether a
panel card's sticky reply row stood at its scroller's floor, beside
`stuckBox` (`geometry.js`, #2285), which answers whether any sticky box
is stuck. `replyPinned` is now `stuckBox(reply) === reply`, so the reply
row's landings, growth, follow and held-news readings and
`focusedInView` read one answer.

The two disagreed in one case: a reply row standing on the list's foot
line at its own place, the thread's very end. `replyPinned`'s callers
need it pinned there, since a turn arriving above pushes it past the
line, where it sticks; read as unpinned, the turn waits behind a notice
instead of being followed. `stuckBox` got that answer only because it
read the card's border box and the card's padding covered the gap; it
now states the foot-line case.

`stuckBox` also asks every sticky box around a node, each in its own
scroller. It stopped at the first scroller, so a focused control in a
reply row's attachment shelf (`overflow-x: auto`) read as unstuck while
its row was stuck.

Behavior change: a long thread's reply row pushed below the list's foot
by its card's start now reads pinned, so a landing into it lands the
thread's end rather than the displaced row.

`--lf-bottom` / `footerInset` stays a separate reading: the band a
footer covers, from its stated height, stuck or not.

New browser test:
`test_a_reply_row_at_its_thread_end_follows_an_arrival_as_a_pinned_one`,
which fails without the foot-line clause.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
Two revision-continuity readers in `version.js` still took raw focus as
the user's place. #2285 gave that rule one owner, `focusedInView()`: a
focused control marks where the user is only while it is in front of
them.

- `activeReadingRegion` ranked the focused region first. Where regions
share the page scroller, the active one's reading restores that
scroller, so focus left in a pane the reader had scrolled past took them
back to it. With two panes in flow at 390px, a textarea focused in the
first, and the reader scrolled on into the second, a revision adding
five paragraphs moved the paragraph they read from 227px to 3056px. It
now asks `focusedInView`, as does `restoreView`'s fallback to the
focused region.
- `restoreEditingContinuity` puts focus back in a reply box that a
revision replaced, through the ordinary Thread route, which scrolls the
box into view. A reader who wrote in the first of 40 threads in the
Threads panel and scrolled the list to 790px was returned to 0 by a
fresh-document revision. Continuity now records whether the box was in
view, and `replyDestination`, `openPageThread` and `showThread` take
`scroll: false`, which presents and focuses the box while moving no
scroller and taking no trip. Focus and words still return to the new
box. Margin-card and widget-seat replies did not move the page in the
same reproduction, since their routes land without page travel.

**Not changed:** `holdReply`, which re-lands a reply box that an
in-document repaint replaced, still scrolls by default. Its likeliest
case, a reply in an `lf-diff` outlet that a data update replaces after
the reader scrolled away, left the reader's paragraph in place when
tried, so it has no failing case yet. Reveals that run before the box is
shown (opening a tab, clearing a Threads filter) are not governed by
`scroll: false`; neither has a reproduction.

Testing:
-
`test_executable_revision_keeps_a_reader_who_scrolled_away_from_their_reply`
is new; without the change the list ends at 0 instead of 790.
-
`test_a_revision_keeps_the_pane_read_over_a_pane_holding_offscreen_focus`
is new; without the change the paragraph moves from 227px to 3056px.
- 41 neighbouring browser tests (executable revisions, reading places,
postures, live revisions, primary reader replacement) pass.
`test_a_live_revision_reorders_the_page_and_ask_inventory_together`
fails identically on the base. The thread-reading and user-place runtime
tests pass.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[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.

2 participants