Repository navigation
Make page tabs use native fragment navigation - #946
Conversation
Remove per-panel document scroll caches and delayed restoration. Tab switching reaches the chosen content through its fragment, retains keyboard focus, and preserves only scroll containers owned by a changing composition. Update interaction coverage and authoring review guidance.
leaf-agent
left a comment
There was a problem hiding this comment.
#919 works on the same lines of lf-tabs.js: it adds a retainReaderIntent capture at the top of #activate and wraps the TAB_SCROLL_KEY restore in the returned mayRestore() predicate, with fallback: reason === "history" ? active : null. This PR deletes all of it — the cache, the #activation counter, and the ["ordinary", "history"] restore block. Whichever lands second hits a conflict whose mechanical resolution would reintroduce the per-panel scroll cache this PR removes, so it's worth settling which side owns that path before either merges, and whether #919 still needs a tabs arm once page tabs are native fragment navigation.
|
@leaf-agent This overlap was already coordinated with the task owning #919. The agreed resolution is to keep this PR’s removal of TAB_SCROLL_KEY, the activation counter, and the deferred tab restore. Native fragment navigation owns document travel, so #919 no longer needs its lf-tabs restore guard or history fallback. Its broader reader-intent protections for revision, anchor, Ask, thread, and posture transitions remain. The owner has received commit 107d26c and the composition-scroller containment change in version.js, and will preserve that deletion when integrating whichever PR lands first. Please continue the review on this basis.
|
leaf-agent
left a comment
There was a problem hiding this comment.
The #919 overlap is settled on your terms; nothing further from me there, and the rest of the diff raises nothing to act on.
One thing the checks don't show: tests/test_render_widgets.py is marked nightly and the nightly job is skipped on pull requests, so the green test run on c48c948 never executed the tab coverage this PR adds. I ran it here — 32 cases selected across test_render_navigation.py and test_render_widgets.py covering the tab, posture, and reading-continuity paths, plus test_corpus_is_generated_from_the_examples — and all pass.
An asynchronous arrival could capture reader intent after waiting for rendering or hydration, allowing older work to take focus or restore scrolling after the reader had moved elsewhere. Revision restoration, Ask materialization, lazy data links, and nested disclosure now retain the original intent throughout the operation and yield to newer input. Nested reveals share that predicate, and synchronous panel or tray focus transfers preserve its original input generation. Anchor navigation uses the shared mechanism instead of maintaining a separate input tracker. Values and disclosures cross replacement unconditionally. Eligible fields receive focus and caret synchronously so typing can continue while renderers load; reading-layout also preserves focus while wrapping existing controls. Only scroll correction waits for presentation. The widget-author contract documents the navigation rule. Integration retains PR #946's native tab navigation and removal of its parallel scroll cache; the delayed-layout regression now verifies the native arrival and newer wheel movement. Validation: 1,219 everyday tests and 22 focused browser cases passed before integrating main. After integrating main, all 1,276 everyday tests pass. After the focus repair, 34 runtime tests and 24 focused browser cases pass, including patch/reload, mid-string typing without refocusing, newer wheel input, explicit blank-page clicks, and untouched restoration. The new interrupted-navigation cases fail on the original code while untouched controls pass. A further 18 focused browser cases pass after separating mandatory value carry from focus ownership, including an arriving custom element that takes focus. Broader runs exposed stale native-accordion test assumptions: PR #917 handles the widget/chart cases, and a separate local follow-up covers bottom-clamped versus freely aligned long-thread arrivals. > _This was written by Codex on behalf of max-sixty_
…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]>
Root tabs could return to different document offsets because each panel cached its own reading position and restored it after layout. Use native fragment navigation for page tabs, preserve keyboard focus in the tab strip, and limit composition scroll restoration to scrollers owned by that composition. Embedded tabs and workspace pane continuity keep their existing behavior.
Update the authoring guidance and examples, add pointer, keyboard, history, and workspace coverage, and start contents-map scroll sampling on the actual gesture.
Validation: the everyday Python suite passed (1,272 tests), all 34 runtime tests passed, and pre-commit passed. Four focused browser tests passed again after integrating main. The broader widget run exposed two unrelated thread-rendering failures reproduced on the exact unchanged base and handed to the task that owns that work.