Repository navigation
Give a popover one face and one way to open from its control, and paint each surface in the ground it names - #5296
Merged
Merged
Conversation
…tated facts one home
Seven popovers each wrote the same raised face: a 1px --border-2 edge, the theme's
radius, ink, the --raise-2 shadow, and a ground. Three of them painted --paper and
four --card. That face now lives once in controls.css as `.lf-popover`, at no
specificity, and reaches declared shadow trees through shadow.css. Visual review's
capture details and threads list, the file editor's conflict choices, the trace's
image scale, the shot's image options, the gloss card, the playground's instruction
and a reply's reaction list take the class, and each keeps only its place, size and
padding. tokens.css gives --card to raised surfaces and --raise-2 to what opens over
the page, so the three paper popovers now paint --card. The reaction list, which
stands in flow while closed, takes the face off only in that state.
The shot, trace and visual review popovers wrapped their anchor placement in
`@supports (position-area: bottom)` over a centred fallback. Every current engine
ships anchor positioning, as the other popovers already assumed, so the guard and
the fallback are gone. Four `::backdrop { background: transparent }` rules restated
the platform's popover backdrop and are gone too.
lf-shot, lf-trace and lf-visual-review toggled their popovers with the same six
lines. `toggleNativeLayer(popover, control, arrival)` in keyboard/layer-stack.js now
does it beside showNativeLayer. While the popover is open it closes it; otherwise it
puts the user on the control, opens the popover from it and moves them to `arrival`.
It is exported through widget-api.js and documented in module-input.md, "Layers",
beside the `lf-popover` class.
Two facts packages restated get one home each:
- `viewDocument(node)` in storage.js, beside the other view helpers, says which
document a widget acts on: the view member holding it, else main. toc-view.js and
lf-dial.js each wrote the selector, and it now reads the views attribute from the
kernel registry's marks.
- text-alignment.js exports its edit cap, MAX_EDIT_LENGTH, which keptLines in
lf-text-document.js copied as a literal 1_000 to match it.
browser/AGENTS.md's "One answer for each question" table gains rows for the toggle
and viewDocument, and module-authoring.md and module-reading.md document the new
exports, as tests/runtime/widget-api.test.mjs requires of every public export.
On screen, the open shot options, trace image scale and visual review capture
details stand on --card where they stood on --paper, in the same places. In the light
scheme the two grounds differ by a shade (#faf9f5 against #fffefb). In the dark
scheme those popovers painted the page's own ground, rgb(25, 24, 21), and now paint
rgb(32, 30, 26), so they part from the page (stills screenshot-options,
trace-image-scale and visual-review-inspection, dark). The gloss card, the playground
instruction and a reply's reaction list draw as before (gloss-open,
playground-instruction, reaction-palette, reaction-pressed).
`leaf-dev stills` gains a `trace-image-scale` state, the trace's image scale with its
choices open, since no state reached that popover. No test changed. The kernel in
dist/kernel/ is rebuilt for the runtime modules this touches.
…und each names package-themes.md says a solid surface sets --lf-ground and paints background: var(--lf-ground), and that its opaque controls paint the same, so a theme or a surrounding card changes them together. These parts painted --paper or --card directly instead: - lf-trace painted its box --paper without naming it its ground, and its opaque parts painted --paper too: the sticky heading, the lane names, the input labels and moment flags that cover the grid lines, the overview, the saved tree's sticky summary, the canvas and its viewer, the input badge and its halo. lf-trace now sets --lf-ground: var(--paper), and those parts paint var(--lf-ground). The sticky chooser of lf-trace-compare stands outside any trace, so it now paints the ground around it. - lf-dial's depth row, which stays opaque as the page scrolls under it, paints the ground it stands on. - Visual review's evidence pane painted a 3% ink tint while its --lf-ground stayed the pane role's paper. The pane now names the tint as its ground, and its header and claim, which stand on the paper, name paper as theirs. - lf-diff's thread outlet and lf-file-editor's comparison name paper as their ground, and lf-file-editor's frame names --card as its own. - The timeline's ground no longer falls back to --paper, since the body always sets --lf-ground. Under the reading theme, whose body ground is --paper, nothing on screen changes: the stills detail, file-editor, playwright-trace-gallery, trace-image-scale and diff-file-reply match their base. Where the ground is not the paper, the dial's row now matches it. In a framed tab, whose ground is --card, the row stood as a paper pill on the card, rgb(25, 24, 21) on rgb(32, 30, 26) in the dark scheme, and now paints the tab's ground (a leaf-dev probe of the detail page's dial inside a framed tab). On a page with no theme, whose body ground is Canvas, the dial's row and the trace comparison's sticky chooser paint Canvas rather than the paper. No test changed.
…ments at a rule that exists The tab strip's selection line and the timeline's playhead each moved in a literal 160ms. browser/AGENTS.md has --lf-motion-* properties set durations, so tokens.css registers --lf-motion-mark at 160ms and both transitions read it. Nothing on screen changes. base.css and text-document.css explained their inset focus rings by pointing at chrome.css's .lf-threads-frame, which left with the classic chrome in #3100. They now point at the floating panel's stage ring in floating-panel.css, which draws its ring on a later box for the same reason.
…ayer stack do what the press owes the control
toggleNativeLayer covered three popover triggers while three others opened through
plain popovertarget and skipped its one step that matters: Safari and Firefox on macOS
leave a pressed button unfocused, so the platform's return on Escape went wherever
focus stood before the press. In Playwright's WebKit, the playground's Show
instruction left focus on the body after opening and after Escape. aria-expanded was
kept three ways: by hand in lf-trace and lf-playground, by nobody on the shot's and
visual review's triggers.
The layer stack already hears every declarative opening and its source through
beforetoggle. It now puts the user on the source as a declarative opening begins,
before the platform records where to return, so Escape and closeNativeLayer hand them
back to the control. It leaves a scripted showPopover({source}) alone, since its
caller places focus. It also keeps aria-expanded on a source that declares one,
through light dismissal too. All six triggers (shot options, trace image scale, visual
review's capture details and threads, the file editor's conflict choices, the
playground's instruction) now open with popovertarget and declare aria-expanded. The
shot, trace and capture details move the user into the popover from its toggle event,
as the file editor already did. The capture details' `i` key presses the control rather
than running its own toggle. toggleNativeLayer, its widget-api.js export, its row in
browser/AGENTS.md and its text in module-input.md are gone; that section now says how
a control opens a popover and lands the user in it.
The popover face applies while the popover is open, as module-input.md says, and names
--card as the popover's ground (--lf-ground), as package-themes.md asks of a solid
surface. The reaction list's closed strip is computed as before again, radius included.
In WebKit, Show instruction now holds focus as the instruction opens and gets it back on
Escape; in Firefox the image options and capture details open on Fit and on their close
control and return to their trigger, as before, with aria-expanded following (leaf-dev
probe, base be6f5bf). On screen nothing changes beyond the previous commit's
popover grounds: stills reaction-palette, reaction-pressed and playground-instruction
match their base, and trace-image-scale and visual-review-inspection differ only in the
open popover's ground. A closed popover now computes the platform's popover defaults,
which it never draws, so their stills style lists name those once.
test_key_scopes.py gains
test_a_popover_its_control_opens_hands_the_user_back_to_the_control, which presses a
popovertarget control with click(), as those browsers do, and checks focus and
aria-expanded through Escape; it fails without the layer stack's focus step.
…overtarget control's expansion to the browser
The layer stack moved focus to the source of any opening that wasn't a showPopover
call, so a script's togglePopover({source}), or an opening a hover starts, could pull
the user out of what they were typing. It now moves focus only when the source is a
declarative control, one carrying popovertarget or commandfor, and the opening is not
a scripted showPopover.
The browser reports a popovertarget control as expanded while its popover is open, and
an aria-expanded attribute overrides that report, so a control whose popover the layer
stack can't hear, such as one in a shadow root no stage watches, would read collapsed.
The six popovertarget triggers (shot options, trace image scale, visual review's capture
details and threads, the file editor's conflict choices, the playground's instruction)
no longer declare aria-expanded. The layer stack still keeps the aria-expanded a
scripted opener's control declares, the reaction list's trigger and the comment box's
Other responses, which the browser doesn't report, and it now reads the source a
showPopover call names where the engine's event doesn't carry it. reactions.js and
composing/selection.js stop writing that attribute themselves, so the layer stack is
its one writer. module-input.md and the layer stack's header say which controls
declare it.
Tests: test_a_popover_its_control_opens_hands_the_user_back_to_the_control now also
opens a popover with showNativeLayer({source}) while the user is elsewhere and checks
that focus stays put and the source's aria-expanded follows the list through Escape.
test_a_playground_opens_its_instruction_over_the_page no longer asserts an
aria-expanded attribute on the instruction's reveal, which the browser now reports.
Nothing on screen changes.
…y the layer stack The previous commit left a popovertarget control's expansion to the browser's accessibility mapping. A symbol trigger's open face (`.lf-icon-action[aria-expanded="true"]`) needs a hook CSS can read, and aria-expanded is the attribute the codebase already styles; a second, non-ARIA attribute would represent the same fact twice. The attribute could only stay stuck at "false" for a popover whose opening the layer stack can't hear, which happens only in a shadow root a package attaches without shadowStage. So there is one rule: a control that opens a popover declares aria-expanded="false", and the layer stack keeps it current on declarative and scripted openings alike. The six popovertarget triggers (shot options, trace image scale, visual review's capture details and threads, the file editor's conflict choices, the playground's instruction) declare it again. module-input.md and the layer stack's header state the rule once. The focus step still moves the user only for a press on a declarative control, and reactions.js and composing/selection.js still leave the attribute to the layer stack. Tests: test_a_popover_its_control_opens_hands_the_user_back_to_the_control checks the popovertarget control's aria-expanded through Escape as well as the scripted opener's, and test_a_playground_opens_its_instruction_over_the_page asserts the reveal's aria-expanded again. Nothing on screen changes.
# Conflicts: # browser/AGENTS.md # dev/leaf_dev/commands/stills.py # dist/kernel/kernel.json # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-passages.js # packages/default/widgets/toc-view.js # packages/detail/widgets/lf-dial.js
# Conflicts: # dist/kernel/kernel.json # packages/visual-review/widgets/lf-visual-review.js
leaf-agent
reviewed
Nov 4, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The test job fails on two checks, and this PR causes both. Each has an inline comment:
test_each_owner_in_the_question_index_is_exported_by_its_modulereads every backticked name in the owner column of the new question-index row as an export oflayer-stack.js, andbeforetoggleisn't one.test_every_skill_file_reads_in_one_commandfindsmodule-authoring.mdat 30,120 characters, over the 30,000 cap.
Apart from these two, the change looks right to me.
…cument viewDocument with reading the page browser/AGENTS.md's row for a popover control's focus and aria-expanded named `beforetoggle` in its owner column, which test_each_owner_in_the_question_index_is_exported_by_its_module reads as an export of keyboard/layer-stack.js. The row now says the layer stack keeps them as each popover opens or closes. viewDocument's sentence moves from module-authoring.md, which it took past the 30,000 characters test_every_skill_file_reads_in_one_command allows, to module-reading.md's "Reading the page", beside authoredScope, the other answer to which part of the page a widget reads.
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-page-layout.js # dist/kernel/runtime/bundle-passages.js # dist/kernel/runtime/bundle-portable.js # dist/kernel/runtime/widget-api.js
leaf-agent
previously approved these changes
Nov 4, 2026
# Conflicts: # browser/AGENTS.md
leaf-agent
approved these changes
Nov 4, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
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. - **The time axis.** lf-timeline and lf-trace each had their own tick, major-tick, flipped-last-label and gridline CSS, restated constants (edge, label chrome, a label gap of 8 in one and 6 in the other, tick spacing), a last-label flip at 36px in one and 44px in the other, three seconds formatters, and four names for an item's place on the axis. `time-axis.js` now exports the geometry and gives each tick its `flip`; one rule in `controls.css` places ticks, gridlines, marks, labels and playheads by `--lf-axis-at`, a widget's own marks joining with `.lf-on-axis`; and one `seconds()` 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. - **The inset focus ring.** A box whose content covers its own outline drew its ring on an `::after` in about six places (the pane body, tab sets, text listings, the diff, the trace image, page threads), each writing the same block. `surfaces.css` now has two rules: `.lf-ring-frame` rings its focused child, and `.lf-ring-overlay` rings its own focus; each frame sets only its own z-index and position. lf-diff no longer creates a `.lf-diff-frame` element. 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.md` says either box must be positioned. What changes for the user: - Trace and timeline gridlines are one dotted `--border-2` line: 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. - Trace labels get the timeline's 8px gap and both flip their last tick label within 44px of the end. - In Firefox, a keyboard landing on a diff's source sits 1px lower. Every other ring is pixel-identical in `leaf-dev stills`, light and dark. Tests: a 60-lane timeline's gridlines reach its foot; the ring cases in `test_rings.py` and the thread, card, pane, obligation and text-document rings; the timeline and trace tests; and `pnpm run test:runtime` and `pnpm run check:browser`. > _This was written by Claude Code on behalf of max-sixty_
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.
Part of the 2026-11-03 sweep for duplicate implementations (#5291 changes how review and Tend look for them). The popover face, opening a popover from its control, each surface's ground, a mark's motion time and two restated facts each get one home.
--border-2edge, the theme's radius, ink, the--raise-2shadow and a ground), three on--paperand four on--card. It now lives once in controls.css as.lf-popover, at no specificity, and reaches declared shadow trees through shadow.css;:where(.lf-popover:popover-open)names--cardas the popover's--lf-ground. Each popover keeps only its place, size and padding. The@supports (position-area: bottom)guards and their centred fallbacks, and four::backdrop { background: transparent }rules that restated the platform, are gone.popovertarget, where three went through a toggle helper and three skipped its focus step. The layer stack, which hears every declarative opening throughbeforetoggle, puts the user on a declarative source (one carryingpopovertargetorcommandfor) before the platform records where to return, so Escape hands them back to the control; a scriptedshowPopover({source})leaves focus to its caller. A control that opens a popover declaresaria-expanded="false", and the layer stack is that attribute's one writer, for declarative and scripted openings alike; reactions.js and composing/selection.js no longer write it. module-input.md and the layer stack's header state the rule.var(--lf-ground), as package-themes.md asks of a solid surface, instead of painting--paperor--carddirectly.--lf-motion-markat 160ms, which the tab strip's selection line and the timeline's playhead read in place of two literals.viewDocument(node)in storage.js says which document a widget acts on, replacing the selectors in toc-view.js and lf-dial.js. text-alignment.js exportsMAX_EDIT_LENGTH, which lf-text-document.js had copied as1_000.What changes for the user:
--card, rgb(32, 30, 26), so they stand apart from the page. In the light scheme the two grounds differ by a shade (#faf9f5 against #fffefb).leaf-dev stillsshows nothing else changing on screen (gloss-open, playground-instruction, reaction-palette, reaction-pressed, detail, file-editor, playwright-trace-gallery, diff-file-reply match their base).stillsgains atrace-image-scalestate, since no state reached that popover.Tests:
test_a_popover_its_control_opens_hands_the_user_back_to_the_controlpresses apopovertargetcontrol as those browsers do and checks focus andaria-expandedthrough Escape, and opens one from a script while the user is elsewhere and checks focus stays put; it fails without the layer stack's focus step.