Repository navigation
Keep the reader's place when an auxiliary surface takes the page's strip - #954
Conversation
Selecting a surface passed the whole transition — the previous surface's hide, the body strip write, and the new surface's own rendering — into `moveContentFrame`'s callback. That callback is the shell write and nothing else: the browser holds the reader's place across the reflow it lands, and that hold rests on the ordering theme.css states at the body strip. Rendering the surface into the same batch switches it off, so opening Threads at 900px left the reader three paragraphs back from the words they were on. One surface now goes down, the shell changes, and the next comes up, with only the strip write inside the frame. `present` already showed its surface outside the frame, so both arrival paths now agree. Refs #952
leaf-agent
left a comment
There was a problem hiding this comment.
The new rule in chrome-layout.js — "change is the shell write and nothing else" — is one the caller twenty lines below already breaks. landEdge passes state(); syncLayout() into moveContentFrame, and the reader survives it: at 1010px the edge's arrow steps reflow the document from 4353px to 5985px and the paragraph under the top edge stays p20 at the same offset. So what the next caller needs is not how little goes inside the call but which work can move the reading column. As written, a reader either narrows landEdge for no reason or concludes the rule is wrong and stops applying it — the outcome the comment exists to prevent. Suggested wording inline.
The reordering itself is right, and the bisect table holds up: with only these two files reverted to the merge base the guard case fails with p8 where p11 was, and passes with the diff in.
Review test selection
tests/test_render_controls.py::test_taking_the_panels_strip_leaves_the_reader_on_the_same_words under --run-nightly: fails on the merge base (assert 'p8' == 'p11'), passes on the merge ref.
tests/test_render_controls.py tests/test_render_navigation.py -k "panel or auxiliary or surface or strip or tray or edge or covering or sheet": 51 passed, 1 failed. The failure is test_render_navigation.py::test_inner_state_is_left_before_the_surface_around_it, which reproduces with these two files reverted to the merge base and is one of the cases #951 repairs.
The landEdge reading above came from an ad-hoc probe, not a committed case: open the panel at 1010px, scroll to 1500, take the paragraph under the root's scroll-padding-top, then press ArrowLeft on .lf-thread-panel > .lf-edge forty times.
`change is the shell write and nothing else` is contradicted by landEdge, which passes syncLayout through the same call and holds the reader across a real reflow. Name the boundary the callers actually observe — a surface's own rendering — so the rule survives its own file.
…r it (#955) #952 reports `test_a_comments_quoted_passage_is_in_the_keyboard_journey` as a runtime regression: the quote still takes focus with `role="button"` and `aria-keyshortcuts="Enter Space"`, but the shortcut bar shows the thread's `r reopen` rung where `return to the passage` should stand. It is neither a runtime regression nor a reading of `quote.found` — the quote is simply not on screen when the bar is read. The case resolves the thread, narrows to Resolved on a covering phone panel, and presses the card's summary to open it. #925 made narrowing retain a card's disclosure, so the card the reader left open comes back open and that press shuts it. Reading the card's `open` either side of the press: `True` before, `False` after. With the card closed the quote has no box, its command scope leaves the bar with it, and the bar falls back to the thread's own rung — which is exactly what the case exists to catch, arriving for a reason the case created itself. The arrangement now states the retained disclosure instead of pressing for it. #951 repairs two other cases of this same class the same way, in `test_render_controls.py` and `test_render_reactions.py`; this is the third, which #951 read as an open question about `quote.found` and left alone. The case does not go green on this branch alone: its later `to_be_checked()` reading of the status filter is the other half, and #951 owns that hunk. Applying #951's two-line change locally on top of this one takes the case to green. The two diffs touch the same test function at different hunks, thirty lines apart, and merge without conflict in either order. This is a nightly case, so a pull request's own `ci` reaches neither half. Refs #952 — automated triage. The issue's other case, the panel strip's scroll anchoring, is #954. Co-authored-by: leaf-agent <[email protected]>
…osure and message workflow line (#951) `ci` on `main` is red. The complete suite on [fd25b4a](https://github.com/max-sixty/leaf/actions/runs/35758716384) reported twenty-one failures and two errors; nineteen of those node ids are already repaired on `main` by #930, #917 and #931. This updates the readings behind the rest, behind two cases those runs never reached, behind two more that #925 reddened after that run — one of which #917 had just repaired — and behind the receipt element #933 removed while this branch was open. No runtime code changes. `main` moved while this branch was open, so it carries a merge of `f4107f63` and every claim below is against that merge base rather than the branch's original `26aa5e20`. ## What moved, and what each case reads now **#936 gave go-to-threads one destination.** `g T` now selects the whole panel whichever thread the reader stood on to ask for it. `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` pressed it from an inline page thread, expected the matching panel card selected, and walked back out in two Escapes; it now reads `.lf-threads` and leaves in one. #936 updated the two navigation cases it could see — this is the third, in a nightly file its gate does not reach. **#933 replaced the message receipt with one workflow line.** Nothing under `skills/leaf/assets/runtime/` writes `.lf-receipt` or `data-receipt-id` any more: a message's status is the `.lf-msg-sending` span in its head, labelled by `conversation/workflow.js`'s `workflowLabel` with the claim detail on `title`. The same `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` read the old element for the root thread on both surfaces and for two later messages, so after #933 it died there — above the go-to-threads reading this PR repairs. Each reading now takes the workflow line under the same head; the identity probes still hold, because the span is retained across the pickup update on both the inline and panel views. **#945 made the thread filters toggles rather than one radio group.** Two cases read the standing status filter with `to_be_checked()`, which a toggle does not answer, and `test_inner_state_is_left_before_the_surface_around_it` read the `w` line as "all threads" where #945 renamed it "clear waiting filter" while the narrowing stands. Each now reads `aria-pressed` and the current wording. **#925 made narrowing retain a card's disclosure.** Its commit message states it — "Native thread disclosure survives filtering, so an answer returns where the reader left it unless they selected another conversation" — and the same commit rewrote `thread-list-view.js`'s module header to match: "Narrowing retains that disclosure; opening another named card closes it natively." Two nightly cases press a card's summary a second time to reopen what the narrowing used to close, so that press now *closes* an open card: - `test_an_ok_on_the_agents_latest_reply_takes_the_thread_out_of_waiting` presses it after restoring the waiting narrowing, and the reaction chip under the agent's message is never visible — `Locator.click: Timeout 30000ms exceeded` on `.lf-react[data-token="keep"]`, "element is not visible". Reading the card's `open` either side of the press: `True` before, `False` after. - `test_every_control_the_layer_offers_is_a_box_the_reader_can_hit` presses it after narrowing to Resolved, so `.lf-reopen` — the one control that arrangement exists to stand up — reads hidden and the aim sweep never reaches its own assertion. Each now asserts the retained disclosure where it used to press for it, so the contract is stated rather than depended on. A third case in the same family took the other half of its repair through #955, now on `main` — see below. **#932 reset the thread card's inherited top margin and dropped its chevron column.** `test_covering_threads_keeps_the_reader_and_their_work_inside` holds the thread list's raw `scrollTop` equal across the placement crossing, which reads as the reader's place only while the list can hold that offset at both placements — a covering sheet's list has a shorter scrollport than the strip beside the document, so the two have different scroll limits. With twelve comments the shorter cards left a list whose whole scrollable range was 63px covering and 17px beside, so the place the case established sat on the covering limit and the crossing clamped it to 85 where 131 was recorded. That is Chromium enforcing the lower limit, not the panel losing the reader's place. The repair states that premise instead of widening the reading. The fixture goes from twelve comments to twenty-four, which is what gives the place headroom at both placements — at twelve the guard fires immediately, `{'at': 36, 'limit': 36}`. `reading_place()` then takes the offset together with the list's own limit and fails at the arrangement unless the offset stands strictly inside it, and each crossing reads it on the placement it leaves *and* on the one it arrives at, because the arrival's limit is the one that can clamp. This replaces the `min(list_at, max_scroll)` clamp #945 put on the same assertion: the clamp settles the symptom, but it accepts whatever the limit imposes, so the crossing assertion can no longer fail and the case stops saying what its docstring says. Bug-backed by forcing a 600px offset before the second crossing — clear of the covering limit at 617, past the beside limit at 571 — which now fails at the arrangement (`the list holds no reading place clear of its limit: {'at': 571, 'limit': 571}`) rather than as `assert 571 == approx(600)`. ## What this leaves on `main` - **The quoted passage's shortcut line is the third retained-disclosure case, and #955 supplied its other half.** `test_a_comments_quoted_passage_is_in_the_keyboard_journey` pressed the card's summary after narrowing to Resolved on a 390px sheet, so — exactly as in the reactions and aim cases above — the press shut a card the narrowing kept open, the quote lost its box, and its command scope left the shortcut bar with it. This branch carries that case's `aria-pressed` hunk; #955 (`fc9d316e`) states the disclosure thirty lines away in the same function. Neither takes it green alone, and with both in it passes. - **#948's strip regression is fixed on `main` by #954** (`13e84e14`). `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` — the reader landing three paragraphs back when the strip arrives — passes there. Nothing here touches it. #952 tracks both cases with the per-commit evidence; its remaining half closes when this branch lands. - **#933's other stale receipt readings are unswept.** `tests/test_render_startup.py` alone names `.lf-receipt` on twenty-four lines, mostly as positive readings rather than count-zero guards, and `test_render_options.py`, `test_render_margin.py`, `test_render_conversations.py` and `test_render_export.py` carry more. `test_a_thread_says_what_the_agent_is_doing_about_it` and `test_a_work_line_says_when_its_claim_has_gone_quiet` both fail on this branch for the same missing element, and `test_the_thread_follows_the_decision_that_still_stands` reads the status filter as `Resolved` where #945 gave it the `Resolved (0)` count this branch already reads in `test_render_controls.py`. They are the same class of stale reading as the six here, but a separate sweep in files this branch does not touch: `main`'s own complete suite on `f4107f63` is the run that enumerates them, and it was still queued when this was written. ## Verification The four touched files run entire on the branch under `--run-nightly`, on the Linux CI runner, against the branch's own merge base `f4107f63`: `tests/test_render_anchors.py` at 93 passed, and `test_render_controls.py`, `test_render_navigation.py` and `test_render_reactions.py` together at 322 passed with two failures — `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` at `assert 'p8' == 'p11'` and `test_a_comments_quoted_passage_is_in_the_keyboard_journey` missing `return to the passage`. `main` has since moved to `13e84e14`, which settles both: this head merged with it takes those two cases green, along with `test_covering_threads_keeps_the_reader_and_their_work_inside`, whose placement crossings #954's transition reordering could have reached. The merge is clean. Every case this branch repairs on its own is green, and nothing else in those four files is stale. `pre-commit` passes on the changed files. A pull request runs the everyday gate, which reaches none of these files, so `ci` here says nothing about them. `main`'s own complete suite on the merge is the first automatic run that reads them. --------- Co-authored-by: leaf-agent <[email protected]>
…ed scroll box its tab stop (#962) `ci` on `main` was red on [e3cd596](https://github.com/max-sixty/leaf/actions/runs/35777453725) with eleven nightly failures. Eight of them belong to open or merged repairs — #951, #954 and #955. This takes the other three, and two of them turn out to be runtime defects a reader meets rather than stale readings. ## A keyboard press inside a stroke's claim was eaten Draw mode holds a claim over every press on the page — `compatibilityPress` in `skills/leaf/assets/runtime/composing/drawing.js`, a document-capture listener that `preventDefault`s and `stopImmediatePropagation`s — so a stroke lifting over a control does not press that control as well. The claim is lifted on a zero-delay timer scheduled at `pointerup`, so *which* press is still a race, and the reader loses it whenever the release's own work runs long. The reader who loses it gets nothing and is told nothing. `Ctrl+Enter` in the composer the stroke had just opened reaches the `text.send` binding, which calls the Send button's own `click()`; the claim ate it in the capture phase before any listener on the button ran. Send went on reading `aria-disabled="false"`, the drawing stayed pending, and no notice was written. Nothing retries, so the comment was simply lost until the reader pressed again. The layer already states the rule this needs, twice: the aim's `claimPress` lets a click carrying no click count through — "keyboard activation belongs to the control it is on" — and the selection guard in `widget-elements.js` spells the same test as `ev.detail === 0`. Draw mode is the third such claim and had neither. So the reading moves to one name, `pressIsKeyboardActivation` in `runtime/pointer.js`, and all three press claims read it off that. ## A comment took a scrolling box's tab stop away `paintReach` lends a scroll box a keyboard stop unless the box already holds a control of its own — a board is reached through its grips and needs no stop over the whole thing. The anchor note is not such a control. It is the one thing the runtime hangs *inside* a block it does not own: a 1px transparent button that leaves the flow for `position: fixed` the moment it takes focus, so standing on it scrolls nothing. #932 ([aab2edc](aab2edc)) moved that reading from the one sweep, which ran before any note existed, to every layout pass, which runs after. From then on a single comment on a flowchart wider than the window took away the keyboard's only route to the half hanging off its right edge. The reading now asks for the box's own controls and passes over the note. ## The filter reading `test_the_thread_follows_the_decision_that_still_stands` read the status filter as a bare `Resolved` where #945 gave it a count. The assertions either side of it already read `Resolved (1)`; this one now reads `Resolved (0)`, which is what the reject standing means — nothing filed away as answered. ## Verification Both runtime repairs are bug-backed by a new case in an existing file, each failing on `main`'s runtime and passing on this branch: - `test_render_drawing.py::test_a_keyboard_send_reaches_send_while_the_stroke_still_owes_its_press` holds the release's macrotask rather than racing it, so the window the rule is about is stated rather than waited for. Without the fix: `the page never sent the drawing the keyboard sent`. - `test_render_controls.py::test_a_comment_on_a_scrolling_box_leaves_its_tab_stop_alone` reads the same box with the note off and on. Without the fix the second reading is `tabindex="-1"`. `uv run pytest tests` is 1298 passed with five failures this sandbox produces on the unchanged tree — `AF_UNIX` and umask limits, in `test_interact_layer.py`, `test_interact_session.py` and `test_website_server.py`. `npm run test:runtime` is 43 passed and `pre-commit` passes on the changed files. Under `--run-nightly`, `test_render_drawing.py`, `test_render_aim.py` and `test_render_pages.py` are 136 passed together, `test_render_drafts.py` is 83 passed, and the three target cases pass on the current merge base. A pull request's own `ci` reaches none of the nightly cases, so it says nothing about them. ## What this leaves on `main` Main has moved well past the run this is against, and its own complete suite on [f4107f6](https://github.com/max-sixty/leaf/actions/runs/35780122081) enumerates what is left once #951 lands: five stale `.lf-receipt` readings in `test_render_startup.py` and the same element in `test_render_anchors.py`, which #933 removed in favour of the message workflow line, plus `test_render_widgets.py::test_notification_configuration_becomes_a_commentable_local_artifact`. That sweep is in files this branch does not touch and #951 already names it. <details><summary>How the drawing failure was isolated</summary> It reproduces only when `tests/test_render_drawing.py` runs whole — three of four runs at `-n0`, never when the case runs alone — and it did not appear in the previous nightly, which is why it reads as noise until it is traced. The path, recorded from an instrumented run: | reading at the press | value | | --- | --- | | `text.send` binding ran | yes | | `sendBtn` connected, not disabled, the document's own | yes | | `aria-disabled` on Send | `false` | | click reached a capture listener on the button itself | **no** | | a second `dispatchEvent(new MouseEvent('click'))` reached it | **no** | | `claimDraft` refused | never called | Two dispatches at the button failing to reach a listener on the button places the block above it, in the capture phase, which is `compatibilityPress`. Instrumentation that added a round trip before the press — a `page.evaluate` of the composer's state — made the run pass, which is the timer winning the race. </details> Co-authored-by: leaf-agent <[email protected]>
…the gesture (#982) "Keep the reader's place" had been fixed one surface at a time (#919, #922, #937, #946, #954, #955, #956, #971). The thread list had a good hold that no other surface could use. The Page Map restored its raw `scrollTop`, so a group arriving above the view pushed the rows the reader was on down by that group's height. The margin card relied on native anchoring. The panel's visible band was measured three different ways. Separately, `reveal()` took its reader intent when it was called, so an async caller that forgot to pass one got a late capture, and `lf-diff` moved focus and scroll after a network wait no matter what the reader had done since. ## What changed - **`runtime/reader-place.js`**: `placeKeeper(scroller, {items, identity})` holds one reference node's content offset through a mutation. It picks the reference from the pointer, then focus, then the visible band. It suspends `overflow-anchor` while the hold lasts, hands the place to whatever node a render put under the same identity, and follows a running fold. The thread list (keyed by thread id), the Page Map's `renderSheet` (keyed by `data-lf-map-key`), and the margin card's re-render of the same thread (keyed by event id) all use it. A node with an empty identity hands the place to the next candidate and is never matched to another node that also lacks one. - **`geometry.js`**: `visibleBand` (the shown band minus stuck `.lf-pinned` covers) and `landingBand` (minus the declared `scroll-padding`). Read acknowledgement, the thread card's being-read check, conversation landing, and anchor travel now read these instead of measuring for themselves. - **Reader intent**: `reveal(el, intent)` now requires the intent retained at the gesture and throws without one. `lf-diff`'s `stepHunk` and `nextUnreviewed` capture intent before they load a file, and land only if that intent still stands. `references/packages.md` states the contract. `scroll` is still not a cancelling input: the runtime's own landings fire it. `reader-intent.js` now lists the input that begins each way a reader can scroll. A probe confirmed that pressing a scrollbar fires `pointerdown` on the scroller. - **The #954 ordering rule is now the interface**: `chrome-layout.js` exports `takeShell(key)` in place of a frame that took a callback. A surface owner therefore has no way to render inside the frame that native anchoring depends on. ## Behavior that moved - With no pointer or focus to lead, the thread list's hold now uses the topmost visible card, which is what its header said. Before, it used the second. - A card entirely under a stuck heading no longer counts as visible. - The Page Map keeps the rows the reader was looking at, not a scroll offset. ## Tests - `tests/runtime/reader-place.test.mjs` covers candidate order, the clamp-aware correction, band insets, the identity hand-across, and an empty identity that must not hand the place across. Each hand-across case was checked by disabling the hand-across and watching the case fail. - `test_chrome_contracts.py` (everyday) gets a new Page Map continuity test. It fails against the base `page-map-dialog.js` (row moved 36px). The file also takes `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` from the nightly controls file. - `test_render_anchors.py` gets a nightly test: a hunk step still waiting on a file leaves a reader who has pressed elsewhere. It fails against the base `lf-diff.js`. - Local: `npm run test:runtime` 60 passed. A focused browser selection across margin, controls, widgets, projection, anchors, and chrome contracts: 142 passed. `test_render_navigation.py::test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]` fails the same way on the unchanged base. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Opening Threads at 900px moved the reader three paragraphs back from the words they were on.
selectpassed the whole surface transition intomoveContentFrame's callback, and that callback is the shell write and nothing else: the browser holds the reader's place across the reflow the write lands, and the hold rests on the orderingtheme.cssstates at the body strip — nothing may move the reading column except the container-query recalc that runs inside layout. Rendering the surface into the same batch switches that hold off.The transition now reads as what it is: the previous surface goes down, the shell changes, the next comes up, with only the body strip write inside the frame.
presentalready showed its surface outside the frame, so the gesture and arrival paths now agree on where rendering stands.test_taking_the_panels_strip_leaves_the_reader_on_the_same_wordsis the guard; it reproduced the failure before the change and passes after it. That case is nightly, so a pull request's owncidoes not reach it.What the bisect isolated
Showing the panel's dialog is the single trigger, and it is the dialog becoming rendered rather than anything it does to focus:
mainp8under the top edge wherep11wasrefreshConversation()/syncGeneral()focus({preventScroll: true})panel.open = truein place ofpanel.show(), so no dialog focusing stepsshowPanelLayer()show()moved after the frameLocal runs on
f4107f63: the everyday suite is 1283 passed with five failures the same tree produces unchanged without this diff —AF_UNIXand umask limits of this sandbox, intest_interact_layer.py,test_interact_session.pyandtest_website_server.py.npm run test:runtimeis 34 passed.tests/test_render_controls.pyunder--run-nightlyis 94 passed withtest_every_control_the_layer_offers_is_a_box_the_reader_can_hit[True]and[False]red, which #951 repairs.pre-commitpasses on the changed files.Refs #952 — automated triage. The issue's second case, the quoted passage's shortcut line, is a separate diff.