Skip to content

Restore the pre-resize reading before scroll recording replaces it - #2303

Merged
leaf-agent merged 1 commit into
mainfrom
fix/ci-38051185604-visual-review
Oct 10, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/ci-38051185604-visual-review

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A visual-review resize can reflow its selected case enough to move a focused inline editor below the viewport. The region already reports a width shift and Leaf has the editor’s visible pre-shift reading, but a resize-induced scroll event can replace that reading before the scheduled restore runs. Continuity then restores the moved geometry instead of the user’s place.

Snapshot the region readings when the shift is reported and use that snapshot for the deferred restore. Ordinary scroll and future readings still update the live map. The authenticated visual-review journey passes with this change and still fails on current main; the two existing inline-editor resize variants, three reading-region reflow/posture journeys, and 308 runtime tests also pass. A served startup comparison showed the same 255 requests before presentation, with 452 additional code bytes and no new request.

This fixes test_an_authenticated_navigation_journey_becomes_credential_free_review_evidence from main CI run 38051185604.

@leaf-agent
leaf-agent merged commit e8460b6 into main Oct 10, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-38051185604-visual-review branch October 10, 2026 22:19
max-sixty added a commit that referenced this pull request Oct 10, 2026
#2303 snapshots the region readings when a shift is announced, so a
scroll event the resize causes before the restore cannot replace them.
The page's focused-control reading has the same exposure, so it is
snapshotted with them.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
… the focus margin from the sticky-header slot (#2302)

Two follow-ups from #2039, each fixed where its cause is rather than
where it showed.

### A page keeps its place below the banner when the window changes
width

The follow-up said Leaf's reading-position code overrode the browser's
scroll anchoring for a pane on a document page: after a jump, narrowing
moved the landed line 36px. The pane was right. Below about 800px the
banner takes a second row, and the browser's anchoring keeps the
reader's line at the same distance from the window's top, which is then
under the taller banner. A plain document page left the line covered; a
pane only escaped because its own restore measures from the landing band
below the banner.

- `reading-regions.js` watches the page as it watches regions: its width
and the top of its landing band, announced as a shift with no region, in
the same measurement that announces main's window-height shifts.
`regionsSettled` waits for it. A band change without a width change,
such as a page tab strip arriving, is adopted rather than read as
unsettled.
- `version.js` moves the page with the band, then restores regions
against the new band from the readings snapshotted when the shift was
announced (#2303). The page keeps no record of its own: the browser's
anchoring already holds its words, and main now keeps a focused control
in view across the reflow.
- Narrowing then widening returns a pane's line to where the reader left
it (it ended 36px low).

### The focus margin is derived from the sticky-header slot; a visual
review's navigation stays in reach

The visual review's case navigation and view controls scrolled away
above a pair taller than the window. Sticking them needs focus inside a
stuck header to scroll nothing. #2135 did that by having each header
declare where its controls stand (`--lf-head-inset`) and each scroller
restate its landing room, so every new sticky header, the visual
review's two included, needed its own declarations.

- The layer's focus margin is read from the sticky-header slot
(`styles/components/surfaces.css`). A scroller's band has two parts, the
slot it covers whole (`--lf-top-covered`) and the room below it
(`--lf-landing-room`); the root's `scroll-padding-top` reads the same
two, and a box that scrolls restarts them (`state.css`). A focused box's
`--lf-top` less the covered slot is the headers over it the band does
not count, so it lands below them; a box in a header that sticks at its
top also takes the room back, so it counts as shown where it sticks.
- The runtime marks every box that sticks at its top (`data-lf-sticks`,
`reach.js`), so a header declares nothing unless its controls stand
inset from its stick line (the tab strip, the trace toolbar, the
screenshot toolbar). The thread title's and diff header's declarations,
the tab panels' landing-room restatement and `--lf-landing-gap` are
gone.
- The visual review's pane header sticks under the banner at a stated
height (two rows where the review is narrow) and stacks `--lf-top` for
the cases; the shown case's view controls stick under it. The capture
stage isolates its stacking, so a flip's handle and marked regions pass
under them.

The CSS changes are in the `styles/` sources (#2252); the committed
sheets are rebuilt from them.

### Tests

-
`test_a_page_keeps_its_place_below_the_banner_as_the_window_changes_width`
(document and pane): without the change, the document fails narrowing
and the pane fails widening.
- `test_a_visual_review_in_flow_keeps_its_navigation_over_a_tall_pair`:
without the change, the navigation stands 495px above the window.
- `test_focus_in_a_stuck_header_leaves_the_page_where_it_is` keeps
passing with every per-header declaration but the tab strip's removed.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant