Repository navigation
Keep the user's place with one hold where scroll anchoring can't, in place of placeKeeper and the seat's hold - #5396
Merged
Merged
Conversation
… already drawn on screen
News in a thread in the page's flow now follows the standard rule: it draws at once in
the thread the user is in, waits behind "N new" in a thread on screen they're not in,
and draws at once above and below the window. A thread not drawn yet draws at once and
moves what follows it, as the user chose on 4 November.
What changes for the user, against main:
- News arriving in a seat or outlet thread the user is in (focus in it, its reply box
included, or a send of theirs still in flight) draws at once. The control they are on
stays still and the page scrolls what stands above it up by the growth, as a chat
does. Standing on the thread itself, as a send leaves them, its reply box stays still;
standing on a message inside it, that message stays and the reply box below moves
down by the turn. Before, the news waited behind "1 new" until they went to it.
- On a page shorter than its window, which has no scroll to give, news in the user's
thread still waits as in any thread on screen; drawn at once, a progress step moved
the draft 42px down such a page.
- A press into a thread holding news, such as into its reply box, shows the news, the
pressed control held still. Before, a press showed nothing.
- A thread the agent starts in a seat on screen, or at a widget's datum with no seat
yet, such as a bare diff line, draws at once and moves what follows it. Before, it
waited behind a notice in the row it would follow, in place of the seat's
first-message row, or at its margin marker.
- A reply that reopens a resolved thread out of a seat's closed Resolved disclosure
draws at once and moves what follows it. Before, it waited behind a count in the
Resolved summary ("Resolved · 1 · 2 new"). A held reopening's notice no longer stands
in Reopen's place.
Unchanged: a thread on screen the user isn't in holds behind "N new"; the margin's
card, the floating panel's thread view and the Threads list keep their own rules.
How: inline.js owns the in-thread rule, since it owns holdBox, so a package's primary
reader keeps holding. holdBox holds the thread's reply box when focus is on the thread
itself, and reply-landing.js `scrollsAway` says whether a box scrolling the thread can
take the growth. Deleted: HeldArrivals with its surfaces.js wiring (heldOut,
revealHeld, the registration's drawn datums), the margin marker as its notice and the
inventory's keep for it; HeldNews's hold of new threads (seatNotice, showHeldThread,
the `row` option); the Resolved summary's count; setSettlesAt and newsMoves' landing
check; the notice's reopened state. held-news.js goes from 1,128 to 844 lines.
Tests deleted, with the behavior each guarded, now dropped:
- test_a_reopening_in_a_page_seat_waits_in_its_resolved_summary: an agent's reply
reopening a resolved seat thread waited behind the Resolved summary's count.
- test_a_reopening_in_a_folded_diff_thread_waits_in_its_summary: the same in a diff
outlet's Resolved disclosure.
- test_a_reopening_waits_where_the_reopened_thread_would_stand: a reopening waited while
the place it would land in the seat was on screen.
- test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow: a new
seat thread waited in the previous thread's row or the first-message row.
- test_a_thread_the_agent_starts_on_a_bare_diff_line_waits_at_its_margin_marker: a new
thread at a datum with no seat waited at its margin marker.
- test_a_walk_to_a_thread_a_diff_line_holds_lands_in_its_outlet: a walk to such a held
thread showed it in its outlet.
- The helpers only those used: _seat_comment, _agent_turn, _to_upper_third, ROUTE_LINE.
Tests rewritten:
- test_an_agent_turn_arriving_holds_still_the_page_box_being_typed_in: guarded the
turn waiting behind "1 new" with the box still; now the turn draws and the box stays,
with a Firefox case.
- test_a_reply_held_in_a_diff_thread_is_read_once_the_keyboard_opens_it, now
test_a_reply_in_a_diff_thread_draws_where_the_user_is_and_waits_elsewhere: guarded a
reply waiting in the thread the user had just written in, and a press into its box
leaving it waiting; now that reply draws with the box still, and a second one, after
the user leaves the thread, waits and shows by its notice or t, read once shown.
- test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[onto]: guarded "t
onto the thread already stood on is a stay, and the replies wait"; now a user standing
on the thread sees them at once. Firefox cases for "opened" and "onto".
- test_a_new_step_waits_where_its_words_would_move_the_draft, now
test_a_new_step_in_the_thread_being_written_in_leaves_the_draft_where_it_stands:
guarded a progress step waiting where it would move the draft; now on a page that
scrolls the step draws and the draft stays, and on a short page it waits.
- test_held_news_says_one_count_of_all_it_holds: the user reads beside the thread rather
than drafting in it, since news no longer waits in their own thread.
- test_a_thread_resolved_while_its_reply_is_written_keeps_the_user_on_it[diff-clear]:
guarded the resolution waiting behind the notice while the user wrote; now it shows
at once, the card staying among the open ones.
- The hub-seat-held-news stills state reads beside the thread rather than drafting in it.
…ed while they're in it open until they leave Review of db58aee found two regressions: - `scrollsAway` predicted whether a scroll could take the growth and misjudged real layouts: a short tabs panel or the parts grid at the page's foot leaves room the growth fills without extending the scroll, so the draft moved 153px where main held it, and 1px of overflow read as none. It goes. In the thread the user is in, news draws at once on every page; holdBox scrolls what it can and the control moves by the rest, as on a page shorter than its window. - The agent resolving the seat thread the user stood on, with no draft, folded it into the closed Resolved disclosure and moved them to its summary, hiding an answer the agent settled the thread with. The keep that holds a resolved thread among the open ones while its reply is written now holds it while the user is anywhere in it, read through followingFocus so leaving draws the seat again and folds it. The user's own Resolve still folds it at once and lands them on the summary. Also: NewsNotice.total had no consumer since the Resolved summary's count went, and two comments described removed holds (destination.js's held widget arrivals, the notice's header variant). The user-visible changes of the branch against main, updated: - News arriving in a seat or outlet thread the user is in (focus in it, its reply box included, or a send of theirs still in flight) draws at once. The control they are on stays still and the page scrolls what stands above it up by the growth, as a chat does; where the page can't scroll by all of it, as when it is shorter than its window, the control moves by the rest. Standing on the thread itself, as a send leaves them, its reply box stays still; standing on a message inside it, that message stays and the reply box below moves down. Before, the news waited behind "1 new". - A thread the agent resolves while the user is in it shows the resolution at once and stays among the open ones, the user still on it, until they leave it; then it folds into the seat's Resolved disclosure. Before, it waited behind "1 new". - A press into a thread holding news, such as into its reply box, shows the news, the pressed control held still. Before, a press showed nothing. - A thread the agent starts in a seat on screen, or at a widget's datum with no seat yet, draws at once and moves what follows it. Before, it waited behind a notice in the row it would follow, in place of the seat's first-message row, or at its margin marker. - A reply that reopens a resolved thread out of a seat's closed Resolved disclosure draws at once and moves what follows it. Before, it waited behind a count in the Resolved summary. A held reopening's notice no longer stands in Reopen's place. Tests: - test_a_new_step_in_the_thread_being_written_in_leaves_the_draft_where_it_stands, now test_a_new_step_shows_at_once_in_the_thread_being_written_in: its "short" case guarded the step waiting on a page that can't scroll; now the step shows there too and the draft moves down by it. Only the "scrolls" case is shift-watched. - New, test_an_agent_resolving_the_thread_the_user_is_on_waits_until_they_leave: the agent resolving the seat thread the user stands on, with no draft, shows the resolution with the thread still open and focused, and folds it once they leave.
…on main The keep 017297d generalized, holding a resolved seat thread open while the user stood in it, had three faults of its own: a resolution released through HeldNews presents the seat directly, so the followingFocus read ran untracked and the thread never folded once the user left; gesturedOn counts any gesture, so choosing an option in the thread folded it and moved focus to the Resolved summary; and the focus subscription re-ran every seat's render on each focus move. It goes, and inline.js keeps main's rule: a resolved thread stays among the open ones while its reply is being written. Instead, news in the thread the user is in draws at once only when it adds to the thread. Its resolving or reopening waits behind "1 new" as on main, with whatever arrives with it, since a settlement moves the thread between the seat's open threads and its Resolved disclosure, out from under the user: the seat's newsMoves passes the hold over only a change whose `news.settled` is null. The user-visible changes of the branch against main, updated: - News adding to a seat or outlet thread the user is in (focus in it, its reply box included, or a send of theirs still in flight) draws at once: a reply, a step, a reaction, an edit. The page scrolls what stands above the control they are on up by the growth, as a chat does, and where the page can't scroll that far, as when it is shorter than its window, the control moves by the rest. Standing on the thread itself, as a send leaves them, its reply box is the control that stays; standing on a message inside it, that message stays and the reply box below moves down. Before, the news waited behind "1 new". - A resolution or reopening of the thread the user is in waits behind "1 new" as before, and so does whatever arrives in the same reading with it. - A press into a thread holding news, such as into its reply box, shows what it adds, the pressed control held still. Before, a press showed nothing. - A thread the agent starts in a seat on screen, or at a widget's datum with no seat yet, draws at once and moves what follows it. Before, it waited behind a notice in the row it would follow, in place of the seat's first-message row, or at its margin marker. - A reply that reopens a resolved thread out of a seat's closed Resolved disclosure draws at once and moves what follows it. Before, it waited behind a count in the Resolved summary. A held reopening's notice no longer stands in Reopen's place. Tests: - test_a_thread_resolved_while_its_reply_is_written_keeps_the_user_on_it is main's again: its diff-clear case asserts the resolution waits behind "1 new". - test_an_agent_resolving_the_thread_the_user_is_on_waits_until_they_leave, now test_an_agent_resolving_the_thread_the_user_is_on_waits_behind_its_notice: the agent resolving the seat thread the user stands on, with no draft, leaves it open and focused with "1 new", and pressing the notice shows the resolution, folding the thread into Resolved.
# Conflicts: # browser/runtime/thread/inline.js # browser/runtime/thread/thread-card.js
…ts news to wait
Three browser tests pressed a control inside a seat thread, which puts the user in it,
and then expected the agent's news to wait behind the thread's notice. Under the
in-thread rule that news draws at once, the control the user is on staying still and
what stands below it moving, as the reply box below a focused message does. Each now
protects what still holds.
Tests rewritten, with the behavior each dropped:
- test_progress_the_user_spoke_after_keeps_its_steps_and_its_place: a rewrite of a step
the user spoke after waited behind the thread's notice ("1 message edited") while
they stood on its toggle. Now the rewrite draws at once, the steps stay shown or
hidden as the user left them, the toggle stays where it stood, and the user's message
moves by the run's growth alone, less what the page scrolled away above the toggle.
Its shift watch goes, since that move is the rule's result; the positions are
asserted instead. The opened run's case grows the step, which the page can scroll
away, with the toggle clear of the floating panel at the window's foot, where it would
be out of sight and held for nobody (user-place.js, `focusedInView`).
- test_opening_a_rewrite_keeps_room_the_thread_holds: an edit shortening a message
above the reply box the user had clicked into waited behind "1 new" until they
pressed it. Now it draws at once; the room the thread holds, and a rewrite opened in
it, still move nothing.
- test_a_summary_folds_its_messages_where_they_stand: an edit retracting a summary
waited behind the notice while the user stood on the summary's toggle. Now it draws
at once, and the frame the summary moved still keeps the document it loaded.
Checked against main: test_required_page_failure_retains_composer_seat_focus_and_caret
and test_call_diff_source_paths_do_not_alias_durable_rename_coordinates fail on main's
runtime too.
…it can't keep The browser's scroll anchoring now keeps the reader's place through re-renders and revisions, and one Leaf hold, `holdPlace` in `user-place.js`, keeps what anchoring can't: the reply box under the user's hands, the reading line where growth starts on screen between anchoring's box and it, and the place Skim folds. It replaces both one-shot holds: the seat render's `holdBox` now calls it, and `placeKeeper` is gone (take/finish/around, its identity hand-off and its `overflow-anchor` claims), with its uses in the Page Map sheet, the margin card's transcript, reply continuity and the dial. A revision patched in place no longer restores a landmark; it holds the reading line once instead. `edgeAt` and `returnTo` move to `scroll-containers.js`. The 126px case: with the reply box focused but scrolled off screen, an edit from another tab growing the first paragraph of the message whose second the user read moved the paragraph down by the growth, in Chromium and Firefox. No `overflow-anchor: none` stood on its ancestors, and the off-screen focused box was not anchoring's choice: with it still focused, growing the first paragraph in place moved the second 0px. Two things did it: - The message's words were a Lit `.innerHTML` binding, so the edit replaced every paragraph, the one anchoring held among them. Neither engine anchors again on a node that replaces its anchor: replacing the second paragraph as the first grew moved it 105px. `setMarkup` (dom-children.js) now redraws keeping the children an edit leaves equal. - With the first paragraph on screen, anchoring held it, the first box shown, and the growth was inside it. The seat's hold declined because focus was out of view (`focusedInView`), so nothing held the reading. It now holds what stands at the reading line (`readingAt`) when the focused control is scrolled away. With either part reverted the new test fails; retention alone fixes the case with the first paragraph above the window. Two more renders kept replacing what anchoring held, found by the suite: - `lf-pane` declared no `x-patch`, so any revision inside a pane replaced it whole; a revision adding five paragraphs above the reader moved them 337px. It now declares `x-patch: members`; the module reads only which child is which. - A sidebar page's track body set `overflow-anchor: none` on its own scroller, so a revision adding a block above the reader in it moved them 40px. The aside before the body keeps the property, which is what keeps the page's anchoring off the track. Left out of the prototype: taking a list view's room in its first paint (037a422b9). On this base Threads holds a joining row behind its notice, and On me's rows moved 0px with and without it when an ask joined 508px above the list's top, in both engines. Behavior changed (the user's choice, 2026-11-04): a re-render or patch that rewrites the element the reader reads can move them by what grew above it; a keyed re-render no longer hands the place to the node drawn under the same identity, nor does the pointer's or focus's item lead the choice of anchor. A patch in place now also keeps no place where it moves the reader's region between scrollers (a workspace reflowing into the page moved the landmark 536px) or wraps it in a closed disclosure, which the landmark restore opened; a revision followed into a fresh document still does both. Tests deleted, with what each guarded: - placeKeeper's runtime tests in `user-place.test.mjs` (candidate order, clamp correction, nested keepers, identity hand-off, the anchoring claim's lifetime). - `test_revision_keeps_a_focused_control_visible_without_a_text_landmark`: a focused control with no text landmark kept in view across a patch that moved its pane from bounding its scroll into the page's flow. A fresh document doesn't keep it either. - The `inside` case of `test_live_revision_keeps_the_visible_semantic_reading`: the reader's line kept where a patch lengthened words above it in the paragraph they read. Tests rewritten: - `test_live_revision_keeps_the_visible_semantic_reading`, `..._under_a_focused_stuck_tab`, `test_revision_after_revision_keeps_the_reader_on_the_same_line` and `..._pane_holding_offscreen_focus` ran with anchoring off so only Leaf's restore could pass them; they now run with it on, the browser and the patch's kept nodes holding the place. - `test_revision_changes_keep_the_complete_heading_below_user_chrome`, the two `test_revision_reveals_...` and `test_revision_remembers_the_active_region_when_a_workspace_reflows` now arrive as a revision followed into a fresh document, the path whose landmark restore they guard. - `test_a_revision_keeps_the_readers_place_in_a_sidebar_tracks_body` adds a block above the reader's without renaming theirs, since a renamed block is a rewritten one. - `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 it brought into view stays where it stood. New: `test_an_edit_above_the_paragraph_read_holds_it_with_the_reply_box_scrolled_away` (first paragraph on screen and above the window in Chromium, on screen in Firefox), runtime tests for `holdPlace` and `setMarkup`. Measured with `leaf-dev probe`, base vs head, Chromium and Firefox alike: | Case | base | head | |---|---|---| | Agent answers above the typed reply box (vs main) | waits behind "1 new", box 0px | drawn, box 0px | | Dial folds the paragraph read, then back (vs main) | 0.2–0.4px | 0.2–0.4px | | Patch adds 4 paragraphs above the window (vs main) | 0px | 0px | | Patch adds a paragraph on screen above the read line (vs main) | 67px | 0.4px | | On me row joins 508px above the list top (vs main) | 0px | 0px | | Edit grows the paragraph above the one read, box scrolled away (vs #5392) | 126px | 0px | `headerInset` (geometry.js) is no longer exported and `offFlowSurfaceOf` (off-flow.js) is deleted: placeKeeper and reply continuity were their last callers outside them.
…ent-a8b82c62e4140f5f2
# Conflicts: # browser/AGENTS.md # browser/runtime/thread/reply-landing.js # tests/browser/threads/test_seated_threads.py
…e words through setRenderedChildren A revision patched in place restores the reader's landmark again (`restoreView`, as on main and as a revision followed into a fresh document does), after the browser's anchoring, and takes no hold of its own. Without the restore, a patch lost the reader's place in three cases anchoring can't keep, measured with the scratch copies of the tests below in Chromium and Firefox: - a workspace reflowing into the page, its panes' reading moving onto the page's scroll: 428px off in Chromium, 0.4px in Firefox; with the restore, 0.3 and 0.4px; - a region the revision wraps in a closed disclosure: the disclosure stayed closed and the focused control out of sight in both engines; with the restore, opened and shown; - a focused control with no text landmark, its pane moved from bounding its scroll into the page's flow: out of view in Chromium (1169px down); with the restore, in view in both. The patch's own reading-line hold went, since with the restore the two corrected one change twice. Holding after the restore undid it: a reader inside a paragraph whose earlier words the patch lengthened landed 82px off the line the restore had kept, a heading partly under the top chrome went back under it (0.4px against a 12px inset), and a focused control left view again. Holding before the restore was undone by it: a paragraph added on screen above the read line moved the reader 67.4px either way, as on main. That case is main's behavior again; the hold now serves only re-renders: the seat's (`holdBox`) and the dial's. The tests the removed restore had rewritten or deleted are main's again: `test_reading_position.py` whole (anchoring off where main turns it off, the patch path, the `inside` case and `test_revision_keeps_a_focused_control_visible_without_a_text_landmark`) and the sidebar track test's renamed block. `[patch-wheel]` keeps its rewrite: it read the pane's offset mid-glide, which held only while the patch replaced the pane, which `lf-pane`'s `x-patch: members` ended, not the restore. A message's words now reconcile through `setRenderedChildren` (dom-children.js), the revision patch's matching run with every node paired to itself, which lf-text-document already uses for its preview. `setMarkup` and its test go; the runtime test now drives `setRenderedChildren` with parsed markup and finds the rewritten paragraph kept too, its words edited in place. Matching pins unchanged siblings with jsdiff's Myers diff, O(N·D) in the paragraphs: linear for an edit to a few, quadratic only for one that rewrites most of them, as every revision patch is. Measured with `leaf-dev probe`, base origin/main vs head, the same in both engines: | Case | base | head | |---|---|---| | Agent answers above the typed reply box | box 0px | box 0px | | Dial folds the paragraph read, then back | 0.2–0.4px | 0.2–0.4px | | Patch adds 4 paragraphs above the window | 0–0.5px | 0–0.5px | | Patch adds a paragraph on screen above the read line | 67.4px | 67.4px | | On me row joins 508px above the list top | 0px | 0px | | Edit grows the paragraph above the one read, box scrolled away | 126px | 0px | | The same, first paragraph above the window | 126px | 0px |
…the dial's glide off Firefox's anchor Page Map moved the row the user was on by 32.3px when an action joined between the first row in view and it (0.3px on main): the browser's scroll anchoring holds the first row in view, and once placeKeeper went nothing held the focused one. The fix is general rather than Page Map's: every Leaf surface brackets a re-render with its focus hold (`holdFocus`), and that hold's restore now keeps the user's place too (user-place.js, `keepPlace`, installed into focus.js, which cannot import geometry). It keeps the focused control where it stood on screen when its scroller's flow places it; the box a container stands at (`standsAt`, which reply-landing.js declares for a thread and its reply box); or, with the control scrolled away, what stands at the reading line. It keeps nothing for a box a placer positions (the margin's rows, the pins), for a hold handed back in a later task, or for a re-render answering an input the browser is dispatching, whose handler places its own result: the seat's send landing, the panel's press judge, a disclosure's layout. That last rule is what keeps a WebKit click, which leaves focus where it was, from holding the thread's reply box while a summary folds below the pressed toggle (165px), and the panel's held thread height from fighting it (127px). `holdBox` is gone: the seat's re-render keeps its control through the same focus hold, and its reply-box rule is a `standsAt` declaration. Page Map's list registers as a reading region while the map stands, as the command reference's does, so the list is the box that scrolls a row (`scrollersOf` found none before, since only regions count). Measured with `leaf-dev probe`, base origin/main vs head: | Case | Chromium base | Chromium head | Firefox base | Firefox head | |---|---|---|---|---| | Page Map: action joins between the first row in view and the focused row (d0d23cd: 32.3px) | 0.3px | 0.3px | 0.3px | 0.3px | | Margin card: edit grows the message between the first in view and the focused one | 378px | 0px | 378px | 0px | | Seat: agent answers above the reply box being typed in | 0px | 0px | 0px | 0px | | Seat: edit above the paragraph read, reply box scrolled away | 126px | 0px | 126px | 0px | The dial's turn with motion on left the gist standing for the folded paragraph 360.7px below the reading line in Firefox, and Read moved it another 347.9px, on main too; with reduced motion it held. The hold had put the gist back; Firefox's anchoring then followed a gliding block to where its translate drew it and scrolled the page by the glide, frame by frame (anchoring turned off for the turn held it to 0.3px). Each gliding block now carries `overflow-anchor: none` in its own keyframes, so it is no anchor while it glides and the property ends with the glide. Chromium -0.2/-0.2px on both sides; Firefox 360.7/347.9px on main, -0.3/-0.1px here. The panel's press judge (`judgePress`) kept the pressed control on screen with its own scroll arithmetic; it now takes `holdPlace(node)` for that, the same screen-position hold, and keeps its own rule of holding the view's height for a change below the press. New tests, each failing without its fix: `test_an_action_joining_page_map_above_the_focused_row_leaves_it_still` (both engines, 379.5 and 378.7px against 347.2 and 346.4) and `test_a_turn_that_glides_keeps_the_place_in_every_engine` (Firefox, 575.8 against 215.1px).
… inside every surface's focus hold The hold ran inside every surface's `holdFocus`, so it had to guess, per re-render, whether the render answered the user's own input (`window.event`, undefined for a listener in a shadow tree, which undid a widget's own click-then-scrollIntoView landing by 87px) and whether a box followed its scroller's flow (an absolute-position test that dropped Send in its editor, 132px when an agent reply appended). It now runs once, around the presentation of a reading the server took: `holdUserPlace` reads the user's place just before the reading is adopted, and keeps it after the page shows it and the data its widgets read has been delivered (state-application.js). Measured after the whole presentation, a box Leaf positions reads where it now stands, so Send and a diff line's Comment are kept like any other control and the flow test goes; a gesture's own render never passes through it, so `window.event` goes; and `holdFocus` holds focus only again, so focus.js takes no injected keeper and the region lookup runs once per reading. The keep skips once a scroll was chosen since the reading (scrolling.js, `scrollChoices`), and a revision keeps placing its reader with its own landmark restore. One case outside readings: a Page Map entry a widget's own contribution changes, with no reading behind it (a lazy load finishing), moved the focused row 32.3px. Page Map's entry update takes the same hold across its own re-render; for a reading's change the second hold finds the row in place and moves nothing. Behavior given up from 2ca62f4, back to main's: a margin card message focused while its notice is pressed (a gesture) and the news it shows grows a message above it moves by that growth, 378px in both engines, as on main. `test_an_action_joining_page_map_above_the_focused_row_leaves_it_still` drove a local contribution update; it is now `test_a_thread_joining_page_map_above_the_focused_row_leaves_it_still`, the agent's thread arriving by a reading (63px without the hold, 0px with, both engines). Measured with `leaf-dev probe`, base origin/main (859d878) vs head, Chromium | Firefox: | Case | base | head | |---|---|---| | Page Map row, a widget's contribution joins above it | 0.3 / 0.3px | 0.3 / 0.3px | | Page Map row, the agent's thread joins above it | 0 / 0px | 0 / 0px | | Margin card message, notice pressed, edit above it | 378 / 378px | 378 / 378px | | Seat reply box, agent answers above it | 0 / 0px | 0 / 0px | | 126px case, first paragraph on screen | 126 / 126px | 0 / 0px | | 126px case, first paragraph above the window | 126 / 126px | 0 / 0px | | Dial with motion, Skim end / Read end | -0.2, -0.2 / 360.7, 347.9px | -0.2, -0.2 / -0.3, -0.1px | | Send focused, agent reply appends | 0 / 0px | 0 / 0px | | Diff gutter Comment focused, 5 deletions join above | 100 / 100px | 0 / 0px | | Shadow widget's own landing (scroll after) | 917 / 917 | 917 / 917 |
The one hold around a reading from outside the tab, and around Page Map's own redraws, now: - Yields to a scroll still running as well as one finished: a scroll the browser is still moving in a box the place rides in (arrivals.js, `browserScrolls`), and any input since the reading (focus.js, `inputCount`). A wheel or smooth scroll under way across a reading reaches its goal in both engines. - Takes the place from whichever input came last, the resting pointer or focus, then the other, as the place keeper this replaced chose its aim (`recentPlaceInput`). With focus in Page Map's search field and the pointer resting on a row, a thread joining above moved the row 32px; it now stays (0.3px, as on main). - Puts back the first of those places the change moved, with the reading line last where focus is scrolled away, so a pointer resting on a rail nothing moves no longer pre-empts the reading line (the 126px case stays at 0). A place the change left still keeps its scroller: a later place there, below news that joined between them, moves nothing. - Treats a block folded until found as hidden although it keeps its box (geometry.js, `showsContents`), and inline words inside one by `checkVisibility`, rather than by height. The dial's em-wrapped read paragraph no longer holds its invisible words (360.7px off in Firefox on main, 2.7px now). `holdPlace`'s step returns whether it moved anything. The header records the limit for a page's own presenter that draws a reading's change frames after it arrived: the frames between show the move. Every bundled kind measured draws in the frame the reading arrives in. browser/AGENTS.md says which surfaces take the hold for a change with no reading behind it (Page Map, the dial). Tests: runtime cases for each rule (first moved place, a still place keeping its scroller, yielding to a scroll and to input, until-found), each failing with its rule removed; the Page Map join test gains a resting-pointer aim, which fails without the pointer rule, and is renamed for both aims.
max-sixty
marked this pull request as draft
November 4, 2026 23:18
leaf-agent
previously approved these changes
Nov 4, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 5, 2026
…lds (#5397) 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_
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.
… the reading's frame, read the line's block The stability matrix (tests/browser/test_page_holds_still.py, #5398) found three cells main passes and this branch failed, in both engines unless named: - left-window x reply-above, 0 -> 195px: the user typed in the reply box, hovered an earlier message and left the window. The pointer's position stayed where it last moved, so the hold aimed at that message, which the answer joining below it left still, and the still place kept its scroller from the box. pointer.js now forgets a mouse once `pointerout` relates it to nothing, as the browser sends when it leaves the window; a finger's out after a lift keeps its tap's position. Now 0. - Firefox wheel x reply-above, -300 -> -105px: the answer arrived while a wheel was gliding, and the keep yielded to the scroll under way (`browserScrolls`), though the wheel had started before the reading and no frame had let it move the place. The keep now yields to a scroll the browser runs only once a frame has rendered since the reading; in the reading's own frame it pays for the change and the glide goes on. Now -300, the wheel's own travel. - The dial's turn, -0.4 -> 2.6px, with motion and reduced: `readingAt` named the em holding the words at the reading line, whose box starts below its line's top by the leading, so Skim's gist landed 2.6px under the line read. It now names the block holding them. Now -0.4. Matrix, main -> this commit: 62 passed and 16 xfailed on main; here every cell main passes passes, and four of main's expected failures pass (reading x edit-paragraph 84 -> 0, gutter x deletions 100 -> 0, both engines). Their strict marks are #5398's to drop. Firefox's smooth cells stay failing as on main: the keep's scroll stops a smooth scroll under way (smooth x reply-above -2px of 300). Tests: a runtime case that a mouse leaving the window stands nowhere and a lifted finger stays, and the yield test now separates a scroll a frame has moved (yields) from one in the reading's frame (pays the change). Each fails with its rule undone.
…no longer needs a6fe0f0 let the keep pay for a change while a scroll was under way if no frame had rendered since the reading, because the matrix's Firefox wheel x reply-above cell moved the reply box -105px of the wheel's -300. That cell released the answer straight after Playwright's instant wheel, which fires no `scrollend` in Firefox, so the keep saw a scroll still under way. The matrix now releases a wheel's answer after ten still frames (ddbb6da on #5398), and without the gate the cell moves -300 in both engines, as on main. The keep again yields to any scroll the browser is still running. Under the updated matrix Firefox's smooth x reply-above moves -105px without the gate and -33px with it (main -42px), failing on both sides: the gate's keep cut the smooth scroll short as main's does, and without it the scroll runs on and the box moves by the 195px answer. Updated matrix (88 cases), main 1906206 -> this commit: every cell main passes passes, and six of main's expected failures pass (reading x edit-paragraph 84 -> 0, reading x edit-shrinks -42 -> 0, gutter x deletions 100 -> 0, both engines). The pointer and reading-line rules still earn their place: with either undone, left-window x reply-above or the four dial-turn cells fail. Tests: the yield test goes back to yielding to a scroll under way and to input, without the frame case.
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_
…ead rather than their block The fifth review's cases, base 1906206 -> this commit, in Chromium and Firefox: - A pointer parked after typing (review4_chrome_aim, margin pin and right edge), +132 -> 0: the pointer named the pin or, at the right edge, `<main>`, which the answer left still, and that still place kept its scroller from the reply box. A field the user types in now names the place before a resting pointer (focus.js, `typesText`), and the pointer names only a control a press acts on (control-selectors.js, `PRESSES`), never the page's background. - The pointer moved onto a cross-origin iframe, or a Chromium pen leaving range (review5_pointer_reply, review5_pointer_pen_reply), +132 -> 0: focus is in the reply box in both, so the rule above keeps it. No departure rule is added. - Words inside a tall block (review5_reading: a paragraph, `<pre>`, a table cell, a list item, open shadow content, and bare text lines between breaks), +-150 -> 0 on growth and shrinkage above them: `readingAt` named the block, whose top the hold restored after anchoring had kept the words. It now names the words, as a range over the letter at the reading line, which `holdPlace`, `edgeAt` and `returnTo` take, and enters open shadow trees as anchoring does. The dial holds the block of its own that holds those words, since a fold replaces whole blocks, so its turns stay at -0.4. - The keep no longer yields to any input since the reading (`inputCount`); a scroll chosen or under way still ends it. Typing while a page's presenter holds the answer's paint (review4_input key) still moves the box 75px, as Tab there does -307px: the keystroke's own caret landing is a chosen scroll. That needs a presenter that paints frames after the reading, the limit the hold's header records, now with this case. A Firefox answer straight after Playwright's 100px wheel step (review5_wheel_reading) moves the box +32px where 1906206 moves it -100: Playwright's Firefox wheel jumps in one frame and fires no `scrollend`, so the runtime counts the scroll under way for its 80ms quiet rule (measured: one `scroll` event, no `scrollend`, under way to 106ms; Chromium fires both in the jump's frame). That is the harness; no rule is added. Tests: runtime cases that a typed field comes before a resting pointer, which names only a control, and that typing into the place leaves the keep paying; each fails with its rule undone. The reference's `readingAt` describes the range it returns.
…ix this branch fixes to pass New places, each passing on main 0acede6 and here, in both engines: - typing-pin x reply-above: typing in the reply box, then the pointer resting on its thread's margin pin above it. Fails without the rule that a typed field comes before a resting pointer. - typing-edge x reply-above: typing, then the pointer parked on the page's background past the column's right edge. - send-words x reply-above: Send focused by Tab, then the pointer resting on an earlier message's words. Fails without the rule that the pointer names only a control. - reading-lines x lines-grow / lines-shrink: the reply box focused off screen, the reader on the fortieth of eighty hard-broken lines of an agent message, which the agent rewrites with five lines more or fewer at its start. Fails without the hold keeping the words read rather than their paragraph. The lines stand in a thread of their own at the page's end, so no other cell's thread changes. The expected failures this branch fixes are no longer expected: reading x edit-paragraph and reading x edit-shrinks (the words read keep their place as the edit above them grows or shrinks) and gutter x deletions (the diff's Comment stays as five deletions join above it), in both engines. Matrix, 98 cases: main 78 passed, 14 xfailed, and fails the 6 cells above; this branch 84 passed, 14 xfailed.
leaf-agent
reviewed
Nov 5, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
One gap in the hold's stated scope, on holdUserPlace's reading-line fallback (inline).
…key end a pending keep The sixth review's two regressions against origin/main 0acede6, in Chromium and Firefox (main -> c22eabd -> this commit): - Bare text between line breaks inside a tall open shadow root, 150px growing or shrinking above the line read (review6_range_reading): 0/0 -> +150/-150 -> 0/0. `readingAt` descended into the shadow tree to an element and stopped there, so it held the tall block's top. It now gives `caretPositionFromPoint` the open shadow roots under the line (`shadowRoots`, which both engines honor), and holds the letter there. - A disclosure the user opened while bundled `lf-diff` waited on a syntax grammar, so the reading's presentation was still pending (review6_disclosure_bundled): summary 80 -> -60 -> 80. The keep put the line read back after the user's own act had moved it. The keep now yields to a press, or to a key anywhere but in the field it holds, since the reading (focus.js, `onUserInput`); typing into that field leaves it kept, so review4_input's typed key stays as it was. A bundled presenter can paint frames after the reading arrives, so the hold's header no longer says Leaf's own never do. Matrix: a disclosure x press-while-pending cell on the diff page, with a disclosure and a note added after the diff: the reader types a note, scrolls up to read past the disclosure, the agent's data brings a Go file whose grammar is held, the user opens the disclosure, and the grammar arrives. It passes on main and here and moves the summary -140px with the new yield undone. The shadow case has no bundled fixture that draws bare text in a shadow tree a reading grows, so it stays a runtime journey. Tests: the runtime yield test now covers a press and a key at a control (the keep yields) and a key and words typed into the field held (it keeps); each fails with its rule undone.
leaf-agent
reviewed
Nov 5, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
After 5f96679, two claims in the description no longer match the code. The description becomes main's commit message, so both are worth correcting:
- "It yields to any scroll since the reading … and to any input": the keep now yields to a press, a touch or a key, but typing into the held field leaves it kept (
holdUserPlace'sonUserInputreader, and the hold's header). - Under Behavior changed, "every bundled kind measured draws in the frame the reading arrives in": the header now names a bundled presenter that draws late,
lf-diffwaiting on a syntax grammar's download, andpress-while-pendingdepends on that. That bullet, and the 4 November measurement it rests on, should name the diff as the exception.
max-sixty
marked this pull request as ready for review
November 5, 2026 03:40
leaf-agent
approved these changes
Nov 5, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 5, 2026
… a find keeps its place (#5408) Three follow-ups to the one hold from #5396, from its reviews. - **Skim folding a paragraph that began above the window** landed its gist at the paragraph's top, 978px above the window for a 2,700px paragraph, and Read then moved the page 3,244px, on `main` before #5396 too. The dial now lands the gist where the words read stood when their paragraph began above the window, and Read moves it 0.2px. A paragraph that begins inside the window still hands its top to its gist, so the dial's turns stay at −0.4px. The hold-still matrix adds `dial-begun × dial-turn`, a paragraph twelve times the cause's length read in its middle with its top 400px above the window; with the dial's change reverted it fails in both engines, the gist landing 1,842px up. The gist's box lands where the words' letters stood, which puts its own letters half a leading lower (2.1–2.5px), so the case reads the gist by its box. - **The contract says which readers the reading line is held for.** `browser/AGENTS.md` promised it for every reader, but the hold keeps it only for a reader whose focus is scrolled away; a reader who focused nothing is left to anchoring, which holds the first block in view. Holding the line for that reader too was tried and rejected, and the hold's header records why: it kept a diff's line still as five rows joined above it (100px on `main`), but moved words above the line that the change left alone from 45px to −55px, carried a selection drag through the new rows, let a pointer resting over a second column move the first column's words 100px, and let a press inside an embedded frame move what it opened by 140px. The hold-still matrix keeps that case as a strict expected failure, `diff-reading × deletions`, and adds `reading-unfocused × edit-paragraph`, which passes. - **A find on words already on screen keeps its place through a later width change**, and now has a test: `test_words_found_on_screen_become_the_readers_place`, which asserts the found words stay in view, as does the closed-fold test beside it, since how far they move within the window depends on how the filler above them rewraps under the host's fonts. It fails when `scrolling.js` stops counting a single scroll that no layout change explains as the reader's choice. That is the rule a scroll tracker labelling every scroll when it starts would have dropped, since the browser's find sends the page no input, so the cutover doesn't build one. Runtime +10 lines, all header prose in `user-place.js`; `lf-dial.js` +2; tests +110; docs +1. > _This was written by Claude Code on behalf of max-sixty_
This was referenced Nov 7, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
…ave drawn (#5665) The diff refresh test failed because `holdUserPlace`'s keep ran before the page finished drawing the reading. The fix adds one more `await whenDocumentPresented()` before the keep in `state-application.js`. With it, `test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_owner[False-True]` passes again, with its assertion unchanged. It had failed on main since #5396. **Cause.** The keep ran as soon as `notifyDataSubscribers()` returned. That call waits only for the regions the data joins, here the diff. In this case the new patch is rename-only, so the commented line is gone, and the diff's own paint claims another thread pass. That pass parks the reply and opens its margin card, and it ran after the keep: 1. The keep read the reply at a temporary spot in the file's thread outlet, 41 px above where it stood. 2. It scrolled the page 41 px to put the reply back. 3. The margin card then drew the reply somewhere else (353 px vs 530 px on screen). So the 41 px scroll kept neither the page nor the field. The test's expected scroll (page unmoved) is the right reading. `holdUserPlace`'s header already says the keep runs once the page shows the reading, "every renderer and the data its widgets read included". The code now does that. With the fix, the keep reads the reply after it has landed in its margin card. The card's own landing places it, and the page stays where it was. Marking the state applied also waits for those extra paints now, since it follows the same await. **Checks run locally:** - Both cases of the failing test. - `pnpm run test:runtime`: 896 passed. - The Chromium cases of `tests/journeys/test_page_holds_still.py` that cover data-driven diffs, replies, seats and Page Map: 11 passed, 2 marked xfail. - The diff refresh and redraw tests, and the hold tests in `test_agent_replies.py`. Firefox cases of the matrix were not run. Closes #5644 — automated triage Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One Leaf hold now keeps the user's place where the browser's scroll anchoring can't, replacing
placeKeeperand the seat'sholdBox. 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) thatmainpasses, in Chromium and Firefox, and six that fail onmain.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.jsholds those once, after the change has drawn:holdPlace(node, standIn)reads wherenode(an element, or a range over words) stands and returns the step that scrolls it, or whatstandIn(node)names once the change hid or removed it, back there.holdUserPlace()takes it around a reading from outside the tab, wherestate-application.jsapplies 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.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).floating-panel.jsusesholdPlacefor its arithmetic.The revision landmark restore (
version.js) stays as onmain, 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:mainpasses 80 and fails 20; this branch passes 86 and 14 stay expected failures. The six it fixes, both engines:mainA 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 onmainand 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 whilelf-diffstill 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
lf-diffdoes 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.mainholds 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).mainthe 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 onmain; the revision cell fails on both, by an amount that varies run to run. Both stay expected failures. Playwright's Firefox wheel fires noscrollend, so an answer straight after it counts as mid-scroll too; the matrix waits that out.widget-api.jsexportsholdPlaceandreadingAtin place ofplaceKeeper;lf-dialis the bundled consumer, andmodule-scroll-and-motion.mddescribes them.headerInsetis no longer exported, andoffFlowSurfaceOfis deleted.Tests
placeKeeper's runtime tests inuser-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.test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_itis now..._holds_it_with_the_reply_box_scrolled_away, which needs the reading line.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.