Repository navigation
Stop focus creeping under every stuck sticky header - #2135
Merged
Merged
Conversation
The owner asked why an lf-trace widget scrolled inside the page. The first version recorded that as a decision: the authored data-height sized a permanent frame, and the images and saved elements scrolled in an inner body beneath the controls. That contradicts the layer's x-height contract, where a stated height holds room only until the module draws and a drawing with a height of its own then takes it. This reverses that decision: once drawn the recording is as tall as its native images and saved elements, and the page is its only scroller. The original goal, controls next to the evidence, now comes from a sticky header in the kernel's `--lf-top` convention: the controls stick below the banner (or a pane's top) while the recording is on screen, and the body takes `--lf-top` past them so the runtime reads what they cover and landings stop below them. Their height wraps with width, so the module measures it rather than stating it. The controls absorb the frame's top padding, so they keep that room when stuck. Stepping replaces the evidence in place: while any of it shows, the new point's evidence starts where the old one did; from the saved elements, below all of it, it returns to the controls' foot, the one scroll at which stuck controls also stay put. The old inner-scroller reset is gone with the scroller. Near the page's end a step onto a shorter point (a frame has no action or saved elements) would shorten the page and pull everything down, so the body holds the height that place needs. The inner body's reading-region registration and the print rule's height and overflow overrides were dead with the scroller and are removed. The gallery states the drawn height page check --render advises. Behavior the tests now protect: no inner scroller in the widget; the controls stay pressable while the page scrolls through the saved elements; stepping from below returns the evidence under the controls without moving them; and stepping, including onto frames at the page's end, moves neither the evidence nor the controls on screen. These replace the assertions that the inner body scrolled on wheel and reset on toggle. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of the previous commit found the stuck strip too tall on a phone (160px of 844), stepping left a covered image top covered, frames and checkpoints moved everything below the image, held page room was never given back on most paths, and a keyboard step after scrolling past the recording jumped the page. Only the stepper row now sticks; the page selector and frames row scroll away. The stepper is one row of a stated height, so the kernel's sticky header contract (a stated height added to `--lf-top`) holds as written and the ResizeObserver that measured the old wrapping strip is gone. It carries the frame's own `--border-2` rule as a bottom divider, as the tab strip does, so evidence passing under it meets an edge. Stepping: where the stuck stepper covers the evidence's top, or all of it from the saved elements, the new point's evidence starts at the stepper's foot, after which later steps move nothing. Otherwise the evidence stays where it is. A stepper parked at the recording's foot, the whole recording scrolled past, counts as covering nothing. Every image of a page is drawn at its widest image's width, as before, in a box as tall as the tallest of them at that width, so the caption, readout and list below stand still between frames and checkpoints. The held room near the page's end is now a spacer the body ends with, released on every draw and on every resize of the widget. Tests: the saved-elements checks run at 390 and 1440 wide and assert a landing through the layer's landing operation arrives below the stuck stepper; the page-end hold is asserted and then released by a later step; a step after scrolling past the recording leaves the page still; and a new case steps the gallery's real filmstrip, whose frames differ in shape from its checkpoints, asserting the readout and image width stay put. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A third review of the trace widget found Tab creeping the page up under the stuck stepper, one image box per page leaving blank room when the viewport changed shape, a no-image stop moving what follows, a queued release outliving the widget, and folding Saved elements at the page's end moving its summary under the press. Focus: the root's scroll-padding leaves a 12px landing room below the banner, and the stuck stepper's controls stand inside it, so the browser scrolled toward each control it focused, 9 to 11px a key, without the stepper ever moving. The room is now a kernel token, `--lf-landing-room`, and the stepper's controls take it back as a negative scroll-margin-top, so focusing one where it sticks scrolls nothing and revealing a parked stepper lands it where it would stick. module-authoring.md states the rule for every sticky header; lf-diff's pinned file header still creeps 17px a focus and is left for its own change. Image boxes are keyed by shape within a page: images within 2% of one aspect share the widest one's width and the tallest height at it, so a filmstrip of the checkpoints' viewport keeps their zoom and box, and a viewport of another shape gets its own box with no blank room. A stop with no image keeps the page's most common box, with its message in the caption's row, left-aligned like every caption; a page with no images shows the message alone. The scroll-into-place logic is one `#keep(element, top)`, used by a step and by folding Saved elements, whose click now toggles in place so the summary stays under the press. A queued release is cancelled on disconnect, as lf-chart cancels its paint. Not changed: a step taken while a wheel's smooth scroll is still running lands where asked, and the browser's own scroll animation then carries on past it; traced as scroll events with no script behind them, gone when the step follows the animation's end. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A control in a stuck sticky header stands inside its scroller's landing band: the root's band starts 12px below the banner, where headers stick. On every focus the browser scrolled toward the control, and the stuck header never came out from under the band, so the page crept on each key. Measured before this change: a diff's file header 17px a focus, its pinned file action 12px, the trace stepper 9 to 11px, a Threads list title 20px, and a page tab strip, standing wholly inside the band, centred: 403px a key. One kernel rule now settles it for every header. A sticky header declares how far below the slot it sticks against (`--lf-top`) its controls stand when stuck (`--lf-head-inset`); the layer's focus margin takes the scroller's landing room (`--lf-landing-room`) back from that, so a control focused where its header sticks counts as shown, and one revealed from elsewhere lands where it sticks. The room is the scroller's own: 12px on the root, restarted to none wherever a box that scrolls restarts `--lf-top`, and the focus ring's room on the Threads list, which pads its edge for it. Declared by the diff file header and its file action, the page tab strip (whose names stand above the band it is counted in), the Threads list title, a sticky Ask's options and the trace stepper, which drops its own copy of the rule. A column's sticky sidebar measured no creep, and a margin thread's sticky message head holds no control. Inside a workspace pane the stepper neither creeps nor lands high: a stuck header pins to its slot as soon as the box it sticks in shows, so a focus revealing a parked stepper put it at the pane's top before and after this change. A new test focuses a page tab and a diff's file header while both are stuck and asserts the page stays put; it fails without the rule (-313px and -17px). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The trace widget's image boxes grouped every image by its own aspect, which split the gallery's 800x461 filmstrip frames from the 960x640 checkpoints of the same viewport and brought back a zoom change and a moving caption. Checkpoints alone now say which viewports a page had; each frame joins the shape of the checkpoint nearest it in time, so the gallery draws one box again and a recording whose viewport really changes shape still gets a box per viewport. Held room is also given back once the reader scrolls away (on scrollend), so folding the saved elements at the page's end leaves no blank behind. The root's landing room now counts what stands over the whole root (a page tab strip, `--lf-root-headers`) and the gap below it, and the root scroll-padding reads it; a page tab panel's room is the gap alone, and the strip's names declare their plain 8px inset. A sticky header after the tabs on a strip page was centred on focus (-314px) and no longer moves. The column sidebar starts the room again beside `--lf-top`, the one scroller the scrolling mark skips; no landing moved with or without it, since a stuck header pins to its slot as soon as its box shows. A diff's code, a tab stop where it scrolls sideways, starts `--lf-top` again as a box that scrolls, so its focus cannot read the file header over it; it now clears that header and the ring's room as the rows do. Tab from a stuck file header into the code left it under the header before (on main too). Tests: the kernel focus test covers a diff's file action, a header after the tabs and Tab into the code; the gallery's mixed-shape filmstrip must share its checkpoints' box, a recorded viewport change must give each viewport its own box, and folding at the page's end then scrolling away must give the held room back. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/chrome.css # skills/leaf/assets/shadow.css # skills/leaf/references/module-authoring.md # tests/test_render_widgets.py
Main reworked lf-trace (#2099, #2100, #2113): the recording review is in page flow with a reserved capture viewport, a bounded metadata region, a time-scaled timeline and a sticky toolbar. That supersedes this branch's lf-trace work, so the playwright package, its gallery, the corpus and the trace tests take main's versions whole: the sticky stepper, the per-checkpoint image boxes, the held room and its releases, and the branch's trace tests are dropped. What this branch keeps is the layer's sticky-header focus rule (`--lf-head-inset`, `--lf-landing-room` and its restart in state.css), its declarations on the diff file header and action, the page tab strip and panels, the Threads title and a sticky Ask's options, the column sidebar's restart, and the diff code scroller's focus margin. Main's new sticky trace toolbar now declares its inset too: focusing one of its controls while stuck crept the page 14px a key, and moves nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 9, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 9, 2026
main landed #2135, which fixes focus creeping under stuck sticky headers with a per-header `--lf-head-inset` and a root landing room that counts the page tab strip. This branch reads the margin from the sticky-header slot instead (`--lf-top` less `--lf-top-covered`), with every top-sticky box marked by the runtime, so the kernel conflicts take this branch's mechanism. Its declarations of a zero inset (the Threads title, a diff's file header) and the tab panel's reset landing room are dropped; its non-zero insets stay as refinements of where a revealed control lands. #2135's fuller creep test (in a page tab, after the tabs, the file action, and the code's sideways scroller) replaces this branch's copy and passes. 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]>
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.
Tab no longer scrolls the page while it moves between the controls of a stuck sticky header, anywhere in the layer.
The root's landing band (
scroll-padding-top) starts 12px below the banner, and a stuck header sits inside it. The browser treated each focused control there as covered and scrolled toward it, but a stuck header never comes out from under the band, so each key crept the page again; a header standing wholly inside the band was centred instead.The rule
shadow.csssetsscroll-margin-topfrom two properties. A focused element with neither keeps the existing focus-ring margin.--lf-head-inset: how far below its--lf-topslot its controls stand when stuck. The diff file header and action, the page tab strip, the Threads title, the trace toolbar and a sticky Ask's options declare it.--lf-landing-roomis the scroller's landing room:--lf-root-headersplus a 12px gap on the root, and the gap alone in page-flow tab panels. It restarts with--lf-topat every box that scrolls (state.css). The Threads list states its ring room, and the column sidebar states none.mainhad the same defect.module-authoring.mddescribes the declaration for package authors.This branch began as a change to lf-trace's height model. Main's own recording-review rework (#2099, #2100, #2113) superseded that part, so the merge takes main's playwright package whole and keeps only the layer-wide focus fix.
Tests
test_focus_in_a_stuck_header_leaves_the_page_where_it_ispins the page tab strip, a diff file header and file action inside the tabs, a second diff after the tabs, and a short wide diff's code, then asserts that focusing each one leaves scrollY where it was. Each case fails with the kernel rule removed. The Threads title and the trace toolbar were measured with a probe rather than asserted.