Skip to content

Stop replacing and unanchoring what the browser's scroll anchoring holds - #5397

Merged
max-sixty merged 6 commits into
mainfrom
places-anchoring-fixes
Nov 5, 2026
Merged

max-sixty merged 6 commits into
mainfrom
places-anchoring-fixes

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Four renders took the reader's place away from the browser's scroll anchoring: they replaced the node anchoring held, or turned anchoring off where the reader reads. This fixes each at its render. main's place keeper (placeKeeper) and the seat's hold (holdBox) are unchanged, and none of the fixes fights them. This is the first part of the places step of the cutover to one way of knowing what's on screen, after #5361 and #5392; the one hold that replaces those two (#5396) follows, once a generated test of every case lands.

Pixels are origin/main → this branch, measured with leaf-dev probe in Chromium and Firefox alike unless named.

Message words keep their nodes through an edit

A message's words reconcile through setRenderedChildren (thread/messages.js, keptWords), the matching a revision uses, instead of a Lit .innerHTML binding. An edit keeps every node it leaves alone and rewrites a changed paragraph's words in place. Neither engine anchors again on a node that replaces its anchor, so the old binding lost the place on every edit.

  • Reply box focused and scrolled away, an edit from another tab grows the first paragraph of a message above the window: the second paragraph being read moved 126px → 0.
  • With that first paragraph on screen it still moves 126px: anchoring holds the paragraph that grows, and the growth is inside it. Only a hold fixes that case.
  • The seat's own holds are unchanged: reply box with an answer arriving above it 0 → 0, Send focused as a reply appends 0 → 0. A margin card's focused message under an edit stays at 378px, as on main.

The matching (dom-children.js) diffs each list of siblings, and a diff costs the list's length times the edits between them, so an edit that changed every paragraph of a message would cost the square of its length. A new rule of the matching, diffWork, bounds that, and the caller chooses it: message words call setRenderedChildren(…, {bounded: true}), and a list whose diff would cost more than 2^18 is replaced, as .innerHTML replaced it. Every other caller keeps main's exact matching, unbounded: authored revisions, whose nodes carry the user's state (two fallbacks tried for them each gave the read paragraph's node away in some revision main handles), and the Markdown file preview, which already reconciled through setRenderedChildren. Completing a Markdown reference definition turns a reference in every paragraph into a link:

Paragraphs 250 500 1,000 2,000
Chromium, main (.innerHTML) 0.7ms 1.2ms 2.3ms 8.8ms
Chromium, this branch 4.1ms 5.7ms 9.4ms 19.5ms
Firefox, main 5ms 11ms 24ms 57ms
Firefox, this branch 10ms 15ms 32ms 78ms

Without the bound, Firefox took 959ms at 2,000 paragraphs. A selection in a paragraph survives an edit elsewhere in the message, where main drops it.

A revision edits inside a pane

lf-pane declares x-patch: members, so a revision edits inside a pane rather than replacing it whole; the module reads only which child is which. A revision adding five paragraphs above a pane's window moved its reader 0 → 0 with main's landmark restore, and now the pane and its body stay the nodes the reader had. For the user, a wheel in a pane while a revision lands there is no longer cut short by the replacement.

A sidebar track keeps its own anchoring

A sidebar page's track body no longer sets overflow-anchor: none on its own scroller. The aside before the body keeps that property (#5383), which keeps the page's anchoring off the track. A block growing 200px above the line read in the track moved it 200px → 0. A revision adding a verdict above it stays 0 → 0 with no frame out of place, so the landmark restore and anchoring don't fight.

The dial's glide no longer drags Firefox's anchoring

The dial's gliding blocks carry overflow-anchor: none in their keyframes, so a block is no scroll anchor while it glides. Firefox anchors on where a box is drawn, so anchoring on a gliding block scrolled the page by its glide. With motion on, Skim then Read on the detail example:

Chromium Firefox
main −0.2, −0.2px 360.7, 347.9px
this branch −0.2, −0.2px −0.3, −0.1px

The paragraph wrapped in an em lands at −0.3 and −0.1px in Firefox too.

One sequence gets worse in Chromium. After a turn has glided, and before any scroll, growth above the reading line, such as an image loading, moves the paragraph read by the growth: 200px in the reviewer's probe, 0 on main. While the blocks glide Chromium anchors on something other than them, and keeps that anchor after the glide until the next scroll. Firefox moves in that sequence on main too. The trade is that rare move in Chromium for the 360px Firefox move on every dial turn with motion on; the stale anchor is the next fix.

Tests

Each new browser test fails with its fix undone.

  • New: test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it (both engines), test_growth_above_the_window_moves_nothing_read_in_a_sidebar_track (both engines), test_a_turn_that_glides_keeps_the_place_in_every_engine (both engines; Firefox's case fails without the keyframes), a runtime test that setRenderedChildren keeps the nodes an edit leaves, and one that a bounded rendered list of 2,000 paragraphs, every one rewritten, is replaced (without the bound it fails, after 4.7s).
  • Rewritten: test_revision_restoration_yields_to_input_while_a_diagram_loads[patch-wheel] read the pane's offset mid-glide and expected it back, which held only while a revision replaced the pane. With the pane patched in place the wheel carries on past that offset, as the user's wheel should. The test now waits for the wheel to settle and checks that what it brought into view stays where it stood; without x-patch, the 220px wheel never takes the pane past 300px and the test times out.

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

Four renders took the reader's place from scroll anchoring: they replaced the node
anchoring held, or turned anchoring off where the reader reads. Each is fixed at its
render, with main's place keeper and seat hold unchanged. Pixels are origin/main ->
this commit, in Chromium and Firefox alike unless named.

- Message words reconcile through `setRenderedChildren` (thread/messages.js,
  `keptWords`) instead of a Lit `.innerHTML` binding, so an edit keeps every node it
  leaves and rewrites a changed paragraph's words in place. Neither engine anchors
  again on a node that replaces its anchor. With the reply box focused and scrolled
  away, an edit from another tab growing the first paragraph of a message, above the
  window, moved the second paragraph being read 126px -> 0. With the first paragraph
  on screen it still moves 126px: anchoring holds that paragraph and the growth is
  inside it, which needs a hold. The seat's own holds are unchanged: reply box with
  an answer above it 0 -> 0, Send focused 0 -> 0. A margin card's focused message
  under an edit stays at 378px, as on main. Test:
  `test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it` (both
  engines), and a runtime test that `setRenderedChildren` keeps the nodes an edit
  leaves.
- `lf-pane` declares `x-patch: members`, so a revision edits inside a pane rather
  than replacing it whole; the module reads only which child is which. With main's
  landmark restore, five paragraphs added above a pane's window moved its reader
  0 -> 0 in both engines (no frame strays), and the pane and its body are now the
  nodes the reader had. What changes for the user: a wheel in a pane while a
  revision lands there is no longer cut short by the replacement.
  `test_revision_restoration_yields_to_input_while_a_diagram_loads[patch-wheel]` read
  the pane's offset mid-glide and expected it back, which held only while the patch
  replaced the pane. It now waits for the wheel to settle and checks that what the
  wheel brought into view stays where it stood. Without `x-patch` the 220px wheel no
  longer takes the pane past 300px and the test times out.
- A sidebar page's track body no longer sets `overflow-anchor: none` on its own
  scroller. The aside before the body keeps the property, which keeps the page's
  anchoring off the track. A block growing 200px above the line read in the track
  moved it 200px -> 0. A revision adding a verdict above it stays 0 -> 0, with no frame
  strays, so the landmark restore and anchoring don't fight. Test:
  `test_growth_above_the_window_moves_nothing_read_in_a_sidebar_track` (both engines).
- The dial's gliding blocks carry `overflow-anchor: none` in their keyframes, so a
  block is no scroll anchor while it glides. Firefox anchors on where a box is drawn,
  so anchoring on a gliding block scrolled the page by its glide. With motion on,
  Skim then Read on the detail example left the gist 360.7px below the reading line
  in Firefox and Read moved it another 347.9px. With main's place keeper, both are now
  -0.3 and -0.1, and the paragraph wrapped in an em lands at -0.3 and -0.1 too. Chromium
  was already at -0.2 and stays there. Test:
  `test_a_turn_that_glides_keeps_the_place_in_every_engine` (both engines; Firefox's
  case fails without the keyframes).

Each new test fails with its fix undone.
# Conflicts:
#	tests/browser/widgets/test_dial.py
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
Message words now reconcile through the revision patch's matching, and a review
found the matching's diff quadratic when an edit changes every paragraph:
completing a Markdown reference definition turns a reference in each paragraph
into a link. At 500, 1,000 and 2,000 paragraphs that edit took 64, 247 and 959ms
in Firefox, against 10, 23 and 57ms for main's `.innerHTML`. An authored
revision rewriting every paragraph of a long section had the same cost on main.

A diff costs the lists' length times the edits between them, so both of the
matching's diffs now stop past 64 edits. Past it, no signature pins anything and
the whole list is one gap, paired by kind, so every paragraph keeps its node; a
gap past it pairs nothing and is replaced. The same edit now takes 4, 8, 17 and
38ms in Firefox and 5.4, 11.4 and 20.7ms at 500 to 2,000 paragraphs in Chromium
(main's 1.1, 2 and 5.8ms), growing with the length in both.

A runtime test rewrites all 300 paragraphs of a list and checks each keeps its
node. It passes without the bound too; the timings above are from
`leaf-dev probe` with the reviewer's journey.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The edit bound in dom-children.js replaces every sibling once a revision inserts more than 64 nodes, where main keeps them all. Details inline.

Comment thread browser/runtime/dom-children.js Resolved
The bound on edits in 30a8a95 made a revision lose what main kept: appending
65 paragraphs exceeded both diffs, so the matching paired nothing and replaced
every node, losing an anonymous textarea's draft, a selection and an open
disclosure; and past the bound, a long revision inserting a paragraph above the
one read paired by kind and gave its node to a neighbour.

The budget is now on work rather than edits: a diff runs while its length times
its edits stays under 2^18, so every list main diffed in a few milliseconds
still gets main's exact pins. Past that, the pins are the signatures each side
holds once, in the longest run both orders keep (patience diff, a binary search
per sibling), and the gaps between pins pair by kind as before. A gap whose kinds
disagree past the budget still pairs nothing.

Measured with `leaf-dev probe` against origin/main on an authored page of 140
and of 1,400 paragraphs, reading the middle one with it focused, through a
revision that rewrites all but the 26 around it and inserts one or ten above,
with a selection in it, or appends 65: in all 16 cases, in Chromium and Firefox,
the paragraph read keeps its node, focus, selection and 225px position, as on
main. Completing a reference definition in a 2,000-paragraph message takes
21.8ms in Chromium (main 10ms) and 35ms in Firefox (main 56ms), linear in both.

Runtime tests: every paragraph of 2,000 rewritten keeps its node; a revision
rewriting every other of 600 and inserting above the one read keeps it and its
rewritten neighbour; appending 65 to 2,000 keeps every node held.
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
Both fallbacks for the bounded diff lost what main keeps in revisions: pairing by
kind gave the read paragraph's node to a neighbour, and patience pins skipped a
read paragraph whose words repeat, or an unchanged one the longest run left out.
An authored revision's nodes carry the user's state, so its matching is main's
again, unbounded.

A renderer-owned subtree carries none: `setRenderedChildren`'s contract keeps
controls with independent state outside it, and before this branch message words
were replaced whole on every edit. So the bound is now a rule of the matching,
`diffWork`: `setRenderedChildren` sets 2^18, the revision patch Infinity. A list
whose diff would cost more is replaced, as `.innerHTML` replaced it, so an edit
rewriting every paragraph of a message costs its length, and nothing the edit
leaves is kept worse than on main.

Completing a reference definition in a message of 250, 500, 1,000 and 2,000
paragraphs takes 4.1, 5.7, 9.4 and 19.5ms in Chromium (main 0.7, 1.2, 2.3,
8.8ms) and 10, 15, 32 and 78ms in Firefox (main 5, 11, 24, 57ms), from
`leaf-dev probe`; unbounded, Firefox took 959ms at 2,000. A selection in a
paragraph survives an edit elsewhere in the message, as before.

The runtime test rewrites every paragraph of a 2,000-paragraph rendered list and
checks it is replaced; with the bound undone it fails, after 4.7s.
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
A review found the bound in `setRenderedChildren` also reached the Markdown
file preview (`lf-text-document`), which reconciled through it on main without
one: 600 paragraphs gaining a reference definition, with an unchanged paragraph
selected after them, kept that paragraph and its selection on main and lost both
with the bound.

So the bound is the caller's to choose: `setRenderedChildren(…, {bounded: true})`
replaces a list past it, and only a caller that drew its subtree whole before
passes it. Message words do (`keptWords`); the file preview, like a revision,
keeps main's exact matching.
@max-sixty
max-sixty merged commit 1906206 into main Nov 5, 2026
4 checks passed
@max-sixty
max-sixty deleted the places-anchoring-fixes branch November 5, 2026 00:50
max-sixty added a commit that referenced this pull request Nov 5, 2026
…5397 left

On main with #5397, the dial's Firefox turn holds the line read (-0.4px, was
708.6px), so its cell is a plain pass. The other strict xfails measure as before.
The dial's depths are now Web Awesome radios (#5393), so a turn presses the radio.

A new cell, dial × grown-after-glide, turns Read to Skim and, once the glide ends,
lets a 200px image load in the gist of the section above. On main the gist read
moves 199.8px in Chromium, which held it at 2e17258 before #5397 (-0.2px), and
199.7px in Firefox, which moved before too (560.7px). Both are strict xfails.
max-sixty added a commit that referenced this pull request Nov 5, 2026
… place in it (#5399)

A revision inside a motion study now edits it in place (`x-patch:
members` on `lf-motion`), as #5397 did for `lf-pane`, so the browser's
scroll anchoring keeps the reader's place among its previews. Replaced
whole, the study lost the node the browser anchored on: a revision
adding five paragraphs at the top of the `motion` example's fold study,
above the window, moved the figure being read 43.9px in Chromium and
45px in Firefox (390×844). It now moves 0.9px and 2px, and stays the
same node. Inserting the same paragraphs by script moves it 0px, so the
last 1–2px comes from the revision install itself; I haven't found the
step. This is part of the places step of the cutover to one way of
knowing what's on screen.

## What else had to change

- **`lf-motion.js`** put a `loadedmetadata` listener on each video at
connection, so a recording a later revision added would never join the
clock: with the declaration alone, an added recording stayed at 0s while
the clock read 2s, and Play stayed unavailable. One capture listener on
the study replaces them; it moves every recording to the clock's time
and redraws the controls. The module otherwise reads its videos fresh
each time.
- **The example's page script**
(`examples/developer/motion.page/motion.js`) set each study up once and
kept the nodes it drew, which worked only because a revision replaced
the study and the script set it up again. It now reads its parts as it
draws and fits again on each `PAGE_INTERFACE`, which `page-behavior.md`
already asks of a script holding authored nodes; the code sample on the
page drops its once-per-study guard.

## Behavior changed

A revision inside a playing study used to leave it paused at 0ms; it now
keeps playing.

`lf-trace` needs no declaration: its only authored children are empty
`lf-trace-bookmark`s, so wherever a members patch would be allowed
nothing inside it has changed, and the trace is already kept.

## Tests

In `tests/browser/widgets/test_motion.py`:
`test_a_revision_inside_a_study_keeps_the_paragraph_read_where_it_stood`
(both engines; fails in both without the declaration) and
`test_recordings_a_revision_adds_join_the_studys_clock` (times out with
per-video listeners, and fails on Play's state without the redraw). The
four existing motion tests, `leaf package check packages/motion
--render` and `leaf page check --render` on the example pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 5, 2026
…#5398)

One generated browser test now checks Leaf's guarantee that the page
holds still under the user's aim (`browser/AGENTS.md`): wherever the
user is, a change they didn't make leaves what they read, point at or
type into where it stood. It is the test the places step of the cutover
finishes against: #5396, the one hold that replaces `placeKeeper` and
the seat's hold, has to pass every cell `main` passes, so its remaining
regressions show up all at once instead of one review round at a time.

## How it works

`tests/journeys/test_page_holds_still.py` crosses two lists. `PLACES`
says where the user is and which box marks it: typing in a reply box, a
focused message, Send, a paragraph being read, a margin pin, a pointer
that left the window, a wheel or smooth scroll under way, a Page Map row
under focus or the pointer, a diff gutter Comment, a control under the
pointer inside a widget's shadow tree, the depth dial, a pane, an On me
row. `CHANGES` says what arrives: an agent reply above or below, an edit
that grows or shrinks a message above, a revision that adds above or on
screen or removes above, a new seat thread, Page Map joins, diff
deletions, a dial turn, growth after the dial's glide, a revision in a
pane, an ask. A case exists wherever the change can reach the place
(`Place.around`, `Change.on`): 44 cells, each in Chromium and Firefox.

Each case puts the user there, reads the box's top and left, makes the
change, waits for it to show and settle, and reads the box again; it
must stand within 1px. It also reads the box after every rendered frame
in between, so a move the page paints and then takes back fails, and so
does a frame where the box is gone or has zero width or height. Two
results move the place by design, and their descriptors state how: the
user's own scroll, where every frame must stand on the path from start
to goal, and a new thread drawn at once above the place. The dial's
glide is exempt from the turn's press to the first frame the browser
draws with no animation running; from then on every frame must stand
still. Each case records what it measured as JUnit properties, so
`--junitxml` holds the whole table.

## What `main` gets wrong today

68 cases pass. 20 are strict xfails, `xfail(strict=True, raises=Moved)`,
so only the position check can produce the expected failure: a failed
setup or delivery fails the case, and a fix shows as an XPASS. Each
gives its measured pixels:

| Cell | Chromium | Firefox |
|---|---|---|
| Message focused × reply below it | −195px | −195px |
| Message focused × revision above | −95.5px | −96px |
| Reading × edit of the paragraph read | 84px | 84px |
| Reading × edit shrinking a message above | −42px | −42px |
| Reading × revision on screen above the line | 67.4px | 67.4px |
| Reading × revision removing a paragraph on screen above | −67.4px |
−67.4px |
| Smooth scroll of 300px × reply above | passes | stops after 34 to 66px
|
| Smooth scroll of 300px × revision above | passes | stops after 59 to
102px |
| Diff gutter Comment × deletions above | 100px | 100px |
| Pointer on a control in a shadow tree × deletions | 100px | 100px |
| Dial × growth on screen above after the glide | 199.8px | 199.7px |

The dial row is growth on screen above the reading line, which the
browser's anchoring holds by the first block in view: before #5397
Chromium held there only by chance and until the next scroll, and
Firefox moved 560.7px.

## Where the test stands in for the user

- Firefox on macOS reaches no link or button with Tab, so a message is
focused by a click on its words.
- In a smooth-scroll case the server's answer is released once the
scroll has come 30px. In Firefox the answer arrives mid-scroll; a scroll
that reached its goal first fails the case's setup instead of measuring.
Playwright's calls return about 250ms late during a Chromium smooth
scroll, so there the answer waits for the scroll's end and the cell
measures a finished scroll.
- Playwright's wheel scrolls at once, and Firefox fires no `scrollend`
for it, so a wheel cell releases the answer once the page has stood
still for 160ms, longer than the runtime's 80ms rule for a scroll whose
end it never hears (`SETTLE_MS` in `arrivals.js`).
- The shift watch is off for the file (`shifts_unsurveyed`), since the
cases measure what it watches and an xfail would otherwise fail its
teardown too.

Planted faults confirm the checks fire. A permanent `translateX(50px)`,
`scale(0)` or `scaleX(0)` for three frames, a 200px move taken back, a
50px overshoot of a scroll, and a 50px shift for three frames right
after the dial's glide each fail the case. Holding the answer until a
Firefox smooth scroll has finished fails its setup.

## Cost and tier

The file runs in `tests/journeys/`: the daily run, a manual dispatch,
and any pull request that edits the test. On CI's runner it is over the
8s per case that `tests/browser/` allows (`BUDGETS` in
`suite_profile.py`). In this PR's `test` job at ddbb6da its 88 cases
took 15.1 of the job's 37.6 worker-minutes, a median of 9.7s per case,
and 56 cases were over 8s; for comparison, the heaviest file in a push
run on `main`, `test_render_floating_panel.py`, takes 12.9
worker-minutes for 139 cases. Locally a case takes 1–5s, and the whole
file runs in 97s at `-n 2`. Opening each case's page takes about 2.4s of
it (`Page.goto`). Sharing one page per place would save most of that,
but each change appends to the page's log or publishes a revision, so
the next case would inherit it; each case keeps its own page, as
`tests/AGENTS.md` asks.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 5, 2026
Main's #5397 carries this branch's message words through `setRenderedChildren`,
`lf-pane`'s `x-patch: members`, the track body's scroll anchoring and the dial's
glide keyframes, with a bound on the message words' diff. Resolved to main's
versions of each, the bound included. The dial keeps this branch's hold in place
of main's place keeper, with main's dial face, which no longer imports `rowArrows`
or `keeps`.

The 126px test takes main's above-the-window case and this branch's on-screen case
as one test over both engines, under this branch's name, which browser/AGENTS.md
cites.
leaf-agent pushed a commit that referenced this pull request Nov 5, 2026
…place of placeKeeper and the seat's hold (#5396)

One Leaf hold now keeps the user's place where the browser's scroll
anchoring can't, replacing `placeKeeper` and the seat's `holdBox`. This
is the places step of the cutover to one way of knowing what's on
screen, after #5361, #5392 and the anchoring fixes in #5397. It passes
every case of the hold-still matrix (#5398) that `main` passes, in
Chromium and Firefox, and six that fail on `main`.

## The one hold

Scroll anchoring keeps the reader's place through re-renders and
revisions since #5397, but it holds the first box on screen, so it can't
keep three places still: a control under the user's hands below growth
on screen, the reading line when growth starts between anchoring's box
and the line, and a place the change hides. `user-place.js` holds those
once, after the change has drawn:

- `holdPlace(node, standIn)` reads where `node` (an element, or a range
over words) stands and returns the step that scrolls it, or what
`standIn(node)` names once the change hid or removed it, back there.
- `holdUserPlace()` takes it around a reading from outside the tab,
where `state-application.js` applies the reading, and keeps it once the
page shows it, whichever surfaces the reading redraws. Page Map takes it
around a widget's own contribution joining with no reading behind it. A
gesture's own result is never held; its handler places it.
- The place is, in order: a field the user types in; then the control
under a resting pointer (only a control a press acts on, `PRESSES`, and
nothing once a mouse has left the window) or the focused control,
whichever input came last; then, if focus is scrolled away, the words at
the reading line (`readingAt`, a range over the letter a quarter of the
way down the window). A thread the user sent from stands at its reply
box (`standsAt`).
- The keep puts back the first of these the change moved. A place the
change left still keeps its scroller, so a later place in it moves
nothing. It yields to what the user did since the reading: a scroll they
or a landing chose, one still under way, a press, or a key anywhere but
in the field it holds, so typing into that field leaves the place kept.
- The dial holds the block it folds, with the gist standing in for it.
Page Map's sheet is a reading region while it stands, so its list is the
scroller that keeps its row. The press-in-place correction in
`floating-panel.js` uses `holdPlace` for its arithmetic.

The revision landmark restore (`version.js`) stays as on `main`, and a
revision takes no hold, since the two undid each other by up to 82px.

## Measured

The matrix, `tests/journeys/test_page_holds_still.py`, 50 cells × 2
engines: `main` passes 80 and fails 20; this branch passes 86 and 14
stay expected failures. The six it fixes, both engines:

| Cell | `main` | this branch |
|---|---|---|
| Reading × edit growing the paragraph read | 84px | 0 |
| Reading × edit shrinking a message above | −42px | 0 |
| Diff gutter Comment × deletions above | 100px | 0 |

A new seat thread drawn above the place moves it by the thread on `main`
(153px, which the matrix allows); here it stays at 0. The cases
independent reviews found that a fixture can reach are new matrix cells,
each holding still on `main` and here: typing then a pointer parked on a
margin pin, on page background, or on a message's words; reading line 40
of an 80-line message whose start the agent grows or shrinks by five
lines; and a disclosure the user opens while `lf-diff` still waits on a
syntax grammar. Words between line breaks inside a widget's open shadow
tree hold still too, checked with a probe, since no bundled widget draws
them.

## Behavior changed

- A re-render that replaces the very element the reader reads can move
them by what grew above their line in it (the user's choice, 4
November). No keyed re-render hands the place to a node drawn under the
same identity.
- A presenter that paints a reading's change frames after it arrives, as
`lf-diff` does while it waits on a syntax grammar, shows the move until
the keep runs, and typing in that window ends the hold, since the caret
keeping itself in view is a chosen scroll (+75px after a letter, +86px
after an arrow key, measured with a presenter held back). The hold's
header records the limit.
- Two rarer paths move the reader where `main` holds them, left without
a rule of their own: growth above the reading line inside a closed
shadow tree, where the hold can only name the host (±150px measured; the
only bundled closed root is the text field's), and a press inside a
child frame while a presentation is pending, which the page's input
watch can't see (140px).
- In Firefox, an answer arriving during a smooth scroll or a wheel's
glide is yielded to, so the scroll finishes and the place moves by the
answer, where on `main` the hold's write stops the scroll short. In the
matrix's smooth scroll × reply above, the reply box ends −105px along
the scroll's −300 (the 195px answer pushed it back), against −40px on
`main`; the revision cell fails on both, by an amount that varies run to
run. Both stay expected failures. Playwright's Firefox wheel fires no
`scrollend`, so an answer straight after it counts as mid-scroll too;
the matrix waits that out.
- `widget-api.js` exports `holdPlace` and `readingAt` in place of
`placeKeeper`; `lf-dial` is the bundled consumer, and
`module-scroll-and-motion.md` describes them. `headerInset` is no longer
exported, and `offFlowSurfaceOf` is deleted.

## Tests

- **Deleted:** `placeKeeper`'s runtime tests in `user-place.test.mjs`,
which guarded its candidate order, clamp correction, nested keepers on
one scroller, the identity hand-off, the band-top rule and its anchoring
claim.
- **Rewritten:**
`test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it`
is now `..._holds_it_with_the_reply_box_scrolled_away`, which needs the
reading line.
- **New:**
`test_a_thread_joining_page_map_above_the_row_the_user_is_on_leaves_it_still`
(focus and resting-pointer aims); runtime tests for each rule of the
hold (growth anchoring left, a hidden node's stand-in, the first moved
place, a still place keeping its scroller, yielding to a scroll under
way, to a press and to a key at a control while typing into the held
field keeps it, a typed field before a resting pointer that names only a
control, a mouse leaving the window, until-found folds); the matrix
cells above, with the six fixed cells' expected-failure marks removed.
Each rule's test fails with the rule undone.

## Size

Runtime −141 lines net (+360 −501), `lf-dial.js` −20, tests +164, docs
+28.

> _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.

2 participants