Repository navigation
Draw every time axis and every inset focus ring from one rule - #5368
Merged
Merged
Conversation
The Playwright recording timeline and lf-timeline place their ticks with the shared `time-axis.js` (#3973), but each drew and measured the ruler itself. `packages/playwright/defaults.css` and `packages/timeline/defaults.css` repeated the tick, major tick, flipped last label and gridline rules. Both widgets restated `EDGE` and `LABEL_CHROME`, the trace restated the private `TICK_SPACING`, `LABEL_GAP` was 6 in the trace and 8 in lf-timeline, the last tick label flipped within 44px of the axis's end in one and 36px in the other, and the trace, lf-timeline and `time-axis.js` each wrote a time in seconds. One home for each now: - `.lf-axis-ruler` and `.lf-axis-tick` in `controls.css`, which shadow trees carry too, draw the ruler: each tick at its fraction of the axis (`--lf-axis-at`) inside the drawing's edge (`--lf-axis-edge`), with each major tick's line continuing down the drawing. The drawing clips that line at its foot: the trace's track already did, and lf-timeline's chart now does, which deletes its separate grid layer and its gridline elements. - `time-axis.js` exports `AXIS_EDGE`, `AXIS_TICK_SPACING`, `AXIS_LABEL_CHROME` and `AXIS_LABEL_GAP`, and `axisTicks` marks the major tick whose label flips (`flip`). - `seconds(ms, digits)` writes every time. Without `digits` it uses as few decimals as show the time to the millisecond, as lf-timeline did; the trace asks for three, so its readout keeps its width; a tick takes the decimals its step needs. No time reads differently. module-authoring.md, "Time axes", documents the class, the custom properties and the exports for package authors. Visible changes, from `leaf-dev stills` in light and dark: - The trace's gridlines take lf-timeline's dotted `--rule` line in place of a dashed line at 70% of `--border-2`. In both widgets the line now reads fainter than the lane rules; the trace's dashed line read as heavy as them. - Labels keep 8px apart in both widgets, where the trace kept 6px, so a crowded trace label gives up 2px of room to its neighbour. - The last tick label flips within 44px of the axis's end in both, where lf-timeline flipped at 36px, so a three-decimal time such as "0.125 s" never runs past the end. No state the stills cover changed by it. Tests now find a major tick by `.lf-axis-tick[data-lf-major]`. (cherry picked from commit cf8d881)
A focused box whose own outline something covers or cuts, such as a scroller whose positioned lines paint over its outline, wears its ring on a later box laid over it. Four places drew that box with the same block (`content: ""`, `position: absolute`, `pointer-events: none`, the ring inset by `--focus-ring-inset`, and `--lf-wears-ring: 1` on the box wearing it), and lf-diff drew it on an element of its own: - a pane's body, on the pane (`base.css`), in the body's grid cell; - lf-tabs' and lf-parts' open panel, on the set (`tabs.css`), by anchor; - lf-text-document's `pre`, on its listing (`text-document.css`); - lf-trace's image canvas, on its own `::after` (`playwright/defaults.css`); - lf-diff's source, on a `.lf-diff-frame` span after it, which `lf-diff.js` created for every file (`diff/widget-shadow.css`). `surfaces.css` now holds one rule beside the shared band. A ring frame, the class `lf-ring-frame` or a pane for its body, draws the band on its `::after` while it, or a child of it other than its header or footer, holds visible focus; the child draws none, and the frame declares `--lf-wears-ring`. The ring's box stands at no weight, so each frame keeps only where it stands and how high it stacks: the pane its grid cell, the tab set its anchor, the canvas its z-index of 3. The tab set, the listing, the canvas and the diff's `pre` wear the class, so the diff no longer creates a frame element, and the focus-ring test script no longer looks for one. package-themes.md tells package authors about the class. lf-file-editor keeps its own copy. CodeMirror puts its editable content inside its own scroller, so the nearest box that holds still is the content's grandparent, and the shared rule rings a frame's own child: reaching a grandchild would ring a pane or a tab set for any control focused inside it. lf-diff used a sibling because, its comment said, Firefox did not re-evaluate a parent's `:has()` when focus moved into a source row. In Playwright's Firefox the shared rule's ring followed focus from a diff's source into a row a hunk step landed on and back, as it did in a reduced case in light DOM and in a shadow root. The rings look as they did. In Chromium, `leaf-dev stills` shows `sort-pane`, `walkthrough-diff-source-keyboard` and the new `boxed-tab-panel-keyboard`, `captured-source-keyboard` and `trace-image-keyboard` states pixel for pixel as before. In Firefox the pane, tab panel and listing are identical too, and the diff's ring has the same pixels, but a keyboard landing on a diff's source stands 1px lower: the `pre` now declares `--lf-wears-ring`, so the landing keeps the ring's room on the frame, whose top border the source sits under. Firefox's `trace-image-keyboard` lands at a different scroll from run to run on either arm, so its stills don't compare; a probe of both arms read the same scroll and the same ring. (cherry picked from commit 990ec5c)
…hared rule `.lf-ring-frame` meant two things: a box that wears its focused child's ring (the tab set, the text listing, the diff's `pre`, a pane) and a box that wears its own ring on an overlay (the trace canvas). Every lf-tabs and lf-parts carries the class, so a set that held focus itself, as one a fragment lands on does, drew the landing's ring around the set and an inset ring over its open panel. Each meaning now has its own class in the shared rule: `.lf-ring-frame` rings the child that holds focus, and `.lf-ring-overlay` rings the box's own focus. The rule sets no `z-index`, so each box says how high its ring stacks: the pane, tab set and listing keep 1, the canvas 3, and a page thread none, which lets a page thread take the overlay class and drop its own copy of the ring. package-themes.md says that either box must be positioned. The floating panel's view keeps its own ring: its stage rings a view only where a key came to it and never a thread's view (the user's choice of 3 November), which the frame rule, ringing whichever child holds focus, can't say without an exception. (cherry picked from commit 2247486)
…ing on it from one rule A major tick drew its gridline as a 2000px `::after` that the drawing clipped at its foot, so a timeline taller than that, such as one of sixty lanes (2662px), showed lines that stopped partway down. Each widget now draws its gridlines as it draws its playhead: a layer (`.lf-axis-grid`) over the lanes, from the ruler's foot to the drawing's, holding a `.lf-axis-gridline` at each major tick's time. lf-timeline's chart no longer clips its overflow for them. The placement "edge + fraction × (100% − 2 × edge)" was written about seven times across three sheets, with four names for the fraction (`--lf-axis-at`, `--lf-timeline-at`, `--t` and `--lf-trace-time`). One rule in controls.css now places every tick, gridline, mark, label and playhead on the axis, by `--lf-axis-at`; a widget's own marks join it with the class `lf-on-axis`. The trace sets its playhead's time on the playhead rather than on the track. Where a drawing sets no `--lf-axis-edge`, the axis has no inset rather than every tick standing at the left. The gridline is now dotted in the contour ink (`--border-2`): 1.47:1 against the ground in light and 1.71:1 in dark, where lf-timeline's dotted `--rule` line gave 1.22:1 and 1.37:1, and the trace's old dashed line 1.31:1 and 1.41:1. Dotted, it still reads under a lane's solid rule. `seconds(ms)` counted its decimals on the unrounded time, so `at="1000.5"` read "1.000 s" and 1500.5 "1.500 s". It now rounds to the millisecond first and writes as few decimals as show that: "1 s" and "1.5 s", as lf-timeline wrote them before. module-authoring.md, "Time axes", describes the placement, the grid layer and the edge's default. (cherry picked from commit ea89352)
leaf-agent
previously approved these changes
Nov 4, 2026
…g.md The time-axis contract the ruler consolidation wrote took module-authoring.md to 31,011 characters, over the 30,000 a skill file may hold so an agent reads it in one command (test_every_skill_file_reads_in_one_command). Time axes are a content helper a widget draws with, as Markdown, code and icons are, so the section moves under module-reading.md's "Content helpers" unchanged.
leaf-agent
previously approved these changes
Nov 4, 2026
`#applyZoom` drew the marks, the ruler and (since the gridline layer) the grid for the scroll position the change was leaving, and each caller then scrolled to the window the new zoom or width shows. `#resized` also drew the ruler again in the same task. Where that second drawing's window was the one the grid showed before the task, the first had taken its lines out and the second put equal ones back, which the write watch fails as an unchanged write (`test_trace_zoom_and_pan_stay_within_the_fitted_recording`, which resizes the page back and forth). Keying the grid's lines differently can't help, since the lines really are taken out in between. `#applyZoom` now takes the window's new left edge, scrolls there first and then draws once (`#layoutLabels` → `#draw`, which draws the ruler and grid); every caller passes the edge it used to scroll to afterwards. (cherry picked from commit 0f3d9c0)
leaf-agent
approved these changes
Nov 4, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
…rom --t The dense-moments journey read each mark's time from --t, which nothing has set since #5368 drew every time axis from --lf-axis-at. Number('') is 0, so every mark's expected position was the axis start and the offset check failed by hundreds of pixels.
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
…operties (#5626) `test_trace_dense_moments_keep_the_axis_usable_and_page_scoped` was still checking the trace widget's old markup in two places. With both reads fixed, the journey passes again (it fails on main). - **Mark position.** The test located each axis mark by reading `--t`. Since #5368 the marks use `--lf-axis-at`, and nothing sets `--t` any more. `Number('')` is `0`, so the test expected every mark at the axis start, and the offset check `max(reading["offsets"]) <= 1` failed by 785–1125 px. This is the failure the scheduled run [42205827418](https://github.com/max-sixty/leaf/actions/runs/42205827418) hit, tracked under #4225. The test now reads `--lf-axis-at`. The widget's placement didn't change. - **Moment flag words.** The test read each flag's words from `data-lf-tip`, which nothing has written since #5614 moved a mark's words into its `lfPreview`. Joining that list of `None` would raise `TypeError`. The test now calls `said_by_marks`, the helper #5614 added and the other trace tests already use, then reads `data-test-tip`. It checks that the shared flags list moments 2–21 in order in the preview's `<name> · Moment N · <time>` lines. `tests/browser/test_render_playwright_trace.py` also read `dataset.lfTip`, but only in a failure message, where it would print `undefined`. That message now names the mark by its text or class. Verification: on head 9deaed2 (tip fix only), the PR's `test` job failed at the offset assertion. Run locally on this head, the journey passes. Refs #4225 --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 14, 2026
Main (#5368) moved every time-axis item's position into one rule in controls.css (`.lf-on-axis`), so the label no longer sets its own `left`. The fix needs that position to cap the label's width to the room on its side of the mark, so the shared rule now names it `--lf-axis-x` and sets `left` from it, and the label reads it in place of the PR's own `--lf-timeline-x`, rather than restating the axis formula in the timeline package. module-reading.md, "Time axes", says so. Main also renamed Leaf's data attributes under data-lf (#5244), so the PR's label reading takes `dataset.lfEvent` and `dataset.lfKind`.
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.
Two browser-UI rows from the 2026-11-03 sweep for duplicate implementations (#5291, #5296). Each capability below was written more than once across the runtime and packages; each now has one home that every widget uses.
time-axis.jsnow exports the geometry and gives each tick itsflip; one rule incontrols.cssplaces ticks, gridlines, marks, labels and playheads by--lf-axis-at, a widget's own marks joining with.lf-on-axis; and oneseconds()formats times. Gridlines run from the ruler's foot to the drawing's foot, as the playheads already did, instead of a fixed 2000px line the chart clipped.module-reading.md, "Time axes", says how a package draws one. lf-trace's zoom now scrolls to its new window before drawing the ruler, once, where a zoom or width change drew it at the old position and again at the new one in the same task.::afterin about six places (the pane body, tab sets, text listings, the diff, the trace image, page threads), each writing the same block.surfaces.cssnow has two rules:.lf-ring-framerings its focused child, and.lf-ring-overlayrings its own focus; each frame sets only its own z-index and position. lf-diff no longer creates a.lf-diff-frameelement. lf-file-editor keeps its own ring, because CodeMirror's editable content sits two levels below the nearest box that doesn't scroll; the floating panel keeps its own, because it rings only views a key opened and never a thread's view.package-themes.mdsays either box must be positioned.What changes for the user:
--border-2line: contrast 1.47:1 in light and 1.71:1 in dark, where the trace's dashed line was 1.31 and 1.41 and the timeline's dotted line 1.22 and 1.37.leaf-dev stills, light and dark.Tests: a 60-lane timeline's gridlines reach its foot; the ring cases in
test_rings.pyand the thread, card, pane, obligation and text-document rings; the timeline and trace tests; andpnpm run test:runtimeandpnpm run check:browser.