Repository navigation
Hold the reader's place through one primitive, and capture intent at the gesture - #982
Conversation
…the gesture
"Keep the reader's place" had been fixed one surface at a time. The thread
list had a good private hold; the Page Map restored a raw scrollTop, so a
group arriving above the view moved the rows the reader was on by that
group's height; the margin card relied on native anchoring; and the panel's
visible band was measured three ways.
- `runtime/reader-place.js`: `placeKeeper(scroller, {items, identity})`
holds one reference node's content offset through a mutation, suspends
`overflow-anchor` for the hold's life, hands the place across to the node
a render put under the same identity, and follows a running fold. The
thread list, the Page Map's `renderSheet`, and the margin card's
re-render of the same thread all take it.
- `geometry.js`: `visibleBand` (shown band less stuck `.lf-pinned` covers)
and `landingBand` (less declared `scroll-padding`). Read acknowledgement,
the thread card's being-read test, landing, and anchor travel read them.
- `reveal(el, intent)` now requires the intent its gesture retained; the
default that captured it after the caller's wait is gone. `lf-diff`'s
hunk step and next-unreviewed walk capture intent before loading a file
and land only while it stands. `scroll` stays out of the superseding
inputs, with the reason stated in `reader-intent.js`.
- The #954 ordering rule is now the interface: `chrome-layout.js` exports
`takeShell(key)` instead of a frame taking a callback, so a surface owner
cannot render inside the frame native anchoring rests on.
Behavior that moved: with no pointer or focus to lead, the thread list now
holds by the topmost visible card (as its header said) rather than the
second; a card wholly under a stuck heading no longer counts as visible.
Tests: `tests/runtime/reader-place.test.mjs` covers candidate order, the
clamp-aware correction, band insets, and the identity hand-across.
`test_chrome_contracts.py` gains an everyday Page Map continuity test and
takes `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words`
from the nightly controls file. `test_render_anchors.py` adds a nightly
test that a hunk step waiting on a file leaves a reader who moved on.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
Page Map item rows all share the identity "", so the hold can pass the reader's place to the wrong row. sheetItemTemplate puts no id on its button (only sheetControlTemplate does), so identity: (row) => row.id returns "" for every comment/item row. placeKeeper's rendered(key) only skips key == null, so when the reference row stops being held, live() hands the place to the first visible item row in DOM order instead of trying the next recorded candidate. That can happen when a search hides its group through ?hidden, or when a state update drops its entry. The list then scrolls so that unrelated row sits where the reader's row was. This regresses the path the PR claims ("the Page Map keeps the rows the reader was looking at"). The new continuity test doesn't catch it because it never makes the reference row leave.
data-lf-map-key is on every row and unique (dialogItemKey includes the entry key), so keying on it fixes this caller. It would also help if placeKeeper treated an empty identity as no identity (!key rather than key == null in rendered). Then an item without an identity would fall through to the next candidate instead of matching every other item without one.
… identity Page Map item rows carry no id, so every one shared the identity "" and a reference that left handed the place to the first unrelated item row. Rows now key on data-lf-map-key, which every row carries uniquely, and placeKeeper treats an empty identity as none. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#982 made `landingBand` the one reading of where a landing may put something. Five runtime callers still parsed `scroll-padding` off the scroller themselves: - anchor travel's centring - anchor travel's arrival check - revision capture - the page step - Ask arrival `landingInsets` in `geometry.js` now states that clearance once. `landingBand` is built from it, and every caller reads it there. The numbers are unchanged. `lf-toc` reads it through the widget API, which re-exports it beside the other geometry that packages use. Verification: - `npm run test:runtime`: 70 passed. - Focused browser runs with `--run-nightly`: 66 of 67 passed across `test_chrome_contracts` and `test_render_navigation`, filtered to landing, step, Ask and revision cases. The failure is `test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]`, which #982 found failing on its unchanged base too. - The arrival cases in `test_render_controls` and `test_render_anchors` passed (6), as did all of `test_render_aim` and `test_render_commands` (76). > _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]>
…he secondary ink, and update three nightly tests (#1002) Main's `nightly` job has been red since the complete suite last took a turn: [run 35837027671](https://github.com/max-sixty/leaf/actions/runs/35837027671) reported five failures on 1b4fb67. Four still reproduce on current main and are fixed here; the fifth, `test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows`, already passes there and is untouched. Behind those four are five causes. Two are defects in shipped code — a package widget that builds a press outside the layer's press contract, and a reference link that misses AA on the ground a chosen row wears. The other three are tests still spelling a contract a merged change moved, each in a `test_render_*` module the everyday gate does not run, so the change landed green and reddened main afterwards. ## The exported corpus offers a press it cannot take `test_the_exported_corpus_stands_on_its_own` found two `button.lf-btn lf-ui` elements wearing the pointer hand in a standalone copy with no script to answer them. `data-lf-offer` is the layer's one spelling of a press: the theme hangs the hand, the hover wash and the here ring on it, and the bake reads it to decide what a file can still work. `lf-job-requests`, added with projected requests in #985, builds its Restart control with `document.createElement("button")`, so it carries no marker — and the bake's `browserControl` selector matches `button:not([data-lf-offer])`, so it read both presses as platform controls that keep working without Leaf and left them standing. What stayed was `.lf-btn`'s own paint over a control whose behaviour went with the scripts. Building it with `offer("button", "lf-btn", "Restart")` is what [`references/packages.md`](https://github.com/max-sixty/leaf/blob/895a629c7a240370bbf6c0d31c7194bdc02bcf0c/skills/leaf/references/packages.md#L442) already asks of a module — "`offer()` and `relabel()` on anything injected" — and produces the same element plus the marker, so the aim floor, the here ring and the `g` target map reach it too. The widget's own nightly case, `test_projected_request_rows_have_independent_buttons`, still passes. ## A block reference misses AA on a chosen row Behind that assertion the same test had a second failure: axe reports `color-contrast` (serious) on the `§ off-t-resync` link in the exported corpus's chosen option, at 4.43:1. It became reachable in the same window for a good reason. On the last green nightly the copy had **lost** the authored `chosen` attribute; it now keeps it. The corpus's log holds no `choose` action for that group, so the attribute is the document's initial condition and keeping it is what the markup says. The row form's ground exists precisely so a copy says which option was taken, and now it paints: `--ok-tint`. `.lf-ref` was asking for `--muted`, the document's quiet ink, which measures 4.433:1 on `--ok-tint`. `--muted-2` is the token the palette states is "held to 4.5:1 against the page surfaces it lands on", and a generated `§` reference is layer chrome rather than document prose, so that is the ink it should have been wearing. The two differ by two points per channel, so nothing visibly moves and the reading clears. Worth a maintainer's eye separately: `--muted` also measures 4.469:1 on `--chip`, so the same shortfall exists anywhere the document's quiet ink lands on a layer surface. Nothing reads it today, and widening the repair past the one element the gate names did not seem mine to decide. ## `reveal` now requires the intent its caller retained #982 removed `reveal`'s default second argument and made a missing one a `TypeError`, so no delayed caller can take a fresh intent after its wait. `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` calls `reveal` through `__lfRuntimeImport` to open whatever container a ring specimen sits in, and still passed one argument. That disclosure is not a reader's delayed work a later input may supersede — it is the arrangement saying what the page must show next — so it hands over the intent that always holds. ## Return submits from a Leaf composer; Shift+Return is the line break #986 moved the shared composer's submit onto Return. `test_a_growing_reply_keeps_its_send_in_the_list` grows a reply box by typing a line and pressing Enter, so each press sent that line as its own reply instead of inserting a newline. The card still overran the list — on eleven arriving messages rather than on the box — so the `assert overran` guard that exists to catch a vacuous run passed, and the failure surfaced thirty seconds later as a `wait_for_function` timeout on the Send button. The test now presses Shift+Enter and reads the reply box's own height before and after the typing, so the next time that key's meaning moves the failure names the cause instead of timing out on a symptom. ## Two commits gave a scoped chrome class a document-level face `test_a_coined_class_cannot_reach_the_chromes_rules` probes for a scoped rule leaking onto a page element, and keeps an explicit list of the classes held out of that probe because the theme dresses them at document level on purpose. #991 put `.lf-compose-placeholder` in both sheets, and #995 did the same for `.lf-action-icon`, `.lf-conversation-head` and `.lf-msg-sending` while rebuilding the margin card's sticky head. All four are the case the list already documents — the theme dresses a shared control or message part wherever it renders, while the chrome's scope only places its own copy — so the exception is widened with each one's reason, which is what the assertion asks for. ## Verification Run on this branch under Ubuntu 24.04 with `--run-nightly`: all four failing cases pass, as do `test_projected_request_rows_have_independent_buttons`, `test_the_feature_gallery_has_no_serious_wcag_a_or_aa_violations`, `test_the_adopted_sheet_decides_nothing_by_standing_last`, and `test_render_options.py` / `test_render_options_addition.py` — 74 passed, one failure. Each of the four was reproduced first on unmodified main, so none of them is the run's own noise. Pre-commit passes on the changed files. That one failure, `test_a_widget_move_keeps_one_target_seat_across_revisions_until_honored`, is not this branch's and is not in the run being fixed: it passed on 1b4fb67, and it fails identically on unmodified 895a629 — alone, under `-n0`, in 10 seconds, on `expect(receipt).to_have_attribute("data-lf-kinds", "sent")`. It is a later regression from the seven commits that landed after this run, and main's in-flight nightly will report it on its own. <details><summary>The run's five failures, and where each stands on current main</summary> ``` tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus TypeError: reveal needs the intent its gesture retained reproduced · fixed tests/test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules extra: lf-compose-placeholder reproduced · three more names since tests/test_render_conversations.py::test_a_growing_reply_keeps_its_send_in_the_list TimeoutError: Page.wait_for_function reproduced · fixed tests/test_render_export.py::test_the_exported_corpus_stands_on_its_own offering: ['button.lf-btn lf-ui', 'button.lf-btn lf-ui'] reproduced · fixed then color-contrast (serious) 4.43:1 on .lf-ref behind it · fixed tests/test_render_projection.py::test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows Locator expected to have count '4', actual 3 passes on main · untouched ``` The contrast reading was pinned against the last green nightly (00d7a41), where the same test passes and the exported chosen option computes `background-color: rgba(0, 0, 0, 0)`; on current main the same node computes `rgb(223, 237, 223)`. </details> Co-authored-by: leaf-agent <[email protected]>
… hold (#1013) Three surfaces still measured for themselves what #982 and #992 made shared. ## Changes - **On screen.** `shownRect`'s clip walk now applies each ancestor's visible band: its shown band less the covers stuck in it. Every reading built on `shownRect` answers the same way: read acknowledgement, the thread card's being-read check, arrival checks, and chrome placement. The thread card had only asked `leaf-thread-list`, so on any other surface it found nothing being read. `read.js` drops its own thread-list special case. A cover belongs to the scroller it sticks in and never hides itself or its contents. Both of those checks climb out of shadow trees. - **Cover room.** `declareCoverRoom(host, property, covers)` in `geometry.js` is now the one way a box becomes a cover. It registers the covers for the visible band, observes them, and keeps the tallest one's height on the host, where a `scroll-padding` or `scroll-margin` reads it. The thread list's run headings and each pinned `lf-diff` file header now use it in place of two hand-rolled ResizeObserver paints. Because the covers are observed rather than measured at reconcile, no layout is forced. A cover that stops rendering, for example when the panel is shut, keeps the room it last measured. The diff's row `scroll-margin` now applies only where its header pins. - **Place hold for packages.** `widget-api.js` exports `placeKeeper` and `declareCoverRoom`, and `references/packages.md` documents both. No package was hand-rolling place preservation. `lf-board`'s `scrollTo` stops an in-flight smooth scroll; it does not hold a place. ## Behavior that moved - `--lf-head-room` is now the heading's exact rendered height, not a rounded `offsetHeight`. `test_the_room_a_run_heading_takes_follows_the_reader_drawing_the_panel` now compares numbers. - Chrome, read acknowledgement, and arrival checks no longer count a box under a stuck run heading or a pinned diff file header as shown. ## `test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]` This test passes on 89902be. I bisected it: it fails at 591e06a and passes at 6802d69 (#999). #999 re-lands the reply in a microtask after a read receipt, because read acknowledgement reflows the prose the reader was just landed in. The unread rail's 8px inline inset and the read boundary both change layout. This PR leaves that re-land in place. Making read marks layout-neutral would change how read and unread messages look. ## Tests - `npm run test:runtime`: 76 passed. A new case covers cover ownership and self-exclusion; I confirmed it fails when either rule is removed. - Everyday `uv run pytest tests`: 1368 passed. - `--run-nightly` across chrome contracts, navigation, read state, conversations, anchors, margin, widgets, controls, projection, aim, commands, options, gate, and drafts: 1323 passed after the head-room test fix. > _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]>
"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, andlf-diffmoved 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 suspendsoverflow-anchorwhile 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'srenderSheet(keyed bydata-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-pinnedcovers) andlandingBand(minus the declaredscroll-padding). Read acknowledgement, the thread card's being-read check, conversation landing, and anchor travel now read these instead of measuring for themselves.reveal(el, intent)now requires the intent retained at the gesture and throws without one.lf-diff'sstepHunkandnextUnreviewedcapture intent before they load a file, and land only if that intent still stands.references/packages.mdstates the contract.scrollis still not a cancelling input: the runtime's own landings fire it.reader-intent.jsnow lists the input that begins each way a reader can scroll. A probe confirmed that pressing a scrollbar firespointerdownon the scroller.chrome-layout.jsexportstakeShell(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
Tests
tests/runtime/reader-place.test.mjscovers 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 basepage-map-dialog.js(row moved 36px). The file also takestest_taking_the_panels_strip_leaves_the_reader_on_the_same_wordsfrom the nightly controls file.test_render_anchors.pygets a nightly test: a hunk step still waiting on a file leaves a reader who has pressed elsewhere. It fails against the baself-diff.js.npm run test:runtime60 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.🤖 Generated with Claude Code