Skip to content

Use Web Awesome controls across interactive widgets - #878

Merged
max-sixty merged 22 commits into
mainfrom
codex/playground-webawesome-controls
Sep 21, 2026
Merged

max-sixty merged 22 commits into
mainfrom
codex/playground-webawesome-controls

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Leaf now uses one pinned Web Awesome 3.13.0 runtime and Leaf-scoped theme for interactive controls in the playground, visual-review, targeting, and diff packages. The rollout covers color, switch, copy, radio, slider, select, combobox, and text-entry controls while preserving Leaf's typed state, form validation, keyboard and Go-to behavior, focus ownership, and copy feedback across instruction edits.

The vendor generator emits one shared ESM and license payload rather than repeating them per widget package. The bundle registers its scoped theme as one constructed stylesheet only when a Web Awesome widget imports it, including for declared shadow roots; pages without these controls load no Web Awesome JavaScript or CSS. Vendor defaults sit in a lower cascade layer so package themes remain authoritative. Text-entry hosts use Leaf's raised --card surface in light and dark themes; other form controls keep the shared --field surface.

A representative playground startup profile on the final head measured 165 requests / 2,954,662 decoded bytes for the candidate versus 164 / 2,526,568 on the base: one request and 428,094 bytes are added before presentation. The controls must upgrade before authoritative presentation so keyboard input, focus, validation, and feedback are ready when the reader can interact.

Validation: 177 widget browser tests and 18 shipped runtime tests passed; all pre-commit hooks passed; Web Awesome regeneration reproduced the tracked outputs. Focused light/dark browser review confirmed the final text-field surface with unchanged geometry and no console errors. Catalog previews were regenerated and pinned to max-sixty/leaf-assets@4c48e9c3.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings hold the verdict; the inline notes are smaller.

Copy instruction leaves the g map. As a native <button> it carried data-lf-offer="button"; as wa-copy-button, offer() writes the empty string, and PRESSABLE in widget-elements.js is [data-lf-offer]:not([data-lf-offer=""]), so the control drops out of pageControls(). Reset and the submit button beside it still take hints and Copy instruction no longer can. The new pressable argument cannot recover it: press() in go-to-sequence.js is control.focus(); control.click(), and wa-copy-button binds @click to its shadow trigger rather than the host, so a host-level click does nothing. That also makes the sentence this PR adds to references/packages.md false for one of its own two custom controls — every visible press built with offer() is documented to join the generated target map. The component's default slot takes a custom trigger and hides its internal button when one is present, so a native offer("button", …) slotted there would keep both the marker and the activation; the labels and the ::part(button) rules would move with it.

Startup bytes rise before presentation with nothing said about it. lf-playground.js imports vendor/webawesome.esm.js statically, so the element cannot upgrade until 265,377 B of extra JS arrives as a new request, and the generated shadow.css adds 52,177 B to the composed, render-blocking theme.css. Three published examples carry that: notification-playground, data-explorer, and code-comparison. CLAUDE.md under Working on the repository asks for the base/candidate profile comparison, and where work lands before presentation, for the change to name the user-visible benefit and why it cannot wait. The description names tests only. A swatch-carrying picker and a real switch may well be worth ~75 KB gzipped on those pages — that is a maintainer's call to make against a stated number rather than an unstated one.

How the two were measured

Both readings come from the PLAYGROUND_PAGE fixture in tests/test_render_widgets.py, served by the test harness on this branch.

  • Markers: every generated node under the playground reports its data-lf-offer. button.lf-btn lf-playground-reset => 'button', wa-switch.lf-playground-input => 'wa-switch', wa-copy-button.lf-playground-copy => ''. Hit-testing the g hints against the nodes under them confirms hints land on pressables only.
  • Host activation: el => { el.focus(); el.click() } on .lf-playground-copy left it outside :state(success); clicking the shadow trigger entered it. The new browser case covers the switch, where host activation does work, so nothing in the suite catches the copy button.
  • Bytes: performance.getEntriesByType('resource') reports theme.css at 447,468 B decoded and vendor/webawesome.esm.js at 265,377 B — the largest script on the page, about six times browser-runtime.js.
  • The generated sheet is the whole Web Awesome default theme, not the three components' share of it: it still carries wa-page, wa-button, and :is(html,body):has(wa-page) rules that no scope on the page can match. And because shadow.css is copied into every declared shadow tree while @scope (lf-playground) can never match inside one (lf-diff is the only x-shadow tag), a page holding both a playground and a diff carries those 52 KB a second time with nothing to apply to.

Comment thread scripts/vendor.py
"@ctrl/tinycolor": "4.1.0",
"@shoelace-style/localize": "3.2.3",
"composed-offset-position": "0.0.6",
"lit": "3.3.3",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lit is now pinned twice and both copies ship on the same page: this table, and lit in the root package.json, which is what scripts/browser/build.mjs bundles into assets/vendor/browser-runtime.js. The comment over PINS states the rule the second copy breaks — "Every pinned version, exact and in one place. A range would let a dependency move under a bundle nobody rebuilt" — and scripts/vendor.py --pins, which the weekly sweep reads, will report drift against this entry while saying nothing about the other. esbuild is already duplicated the same way, but it is the build tool rather than payload, so a mismatch there costs nothing; here it puts two Lit versions in one document.

Reading the version from package.json in build_webawesome (or asserting the two agree) would make them unable to disagree, the way tests/test_mcp_app.py reads the ext-apps version off PINS instead of retyping it.

this.#resetCopyFeedback();
notice(`Could not copy: ${error.message}`);
const instruction = this.#instruction();
if (this.#copy.value === instruction) return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recreates the control on every instruction change, not only when there is feedback to clear — typing 11 characters into the title control replaced it 10 times, each a full custom-element construction, shadow root, and Lit render, and a color drag does the same per pointer move. The status is exposed as a custom state (the theme already reads :state(success)), so the cheap path can stay cheap:

Suggested change
if (this.#copy.value === instruction) return;
if (this.#copy.value === instruction) return;
if (!this.#copy.matches(":state(success), :state(error)")) {
this.#copy.value = instruction;
return;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new coverage refutes this suggestion as written. handleCopy in the vendored bundle opens with if(this.disabled||this.isCopying)return;, so on the cheap path the second copy.click() in test_a_playground_preset_reset_copy_and_narrow_layout_share_the_same_state never reaches writeText — the element is still locked on the held write for the 12px instruction. Applied on top of this head, window.clipboardWrites comes back with one entry and the assertion fails asking for the 5px one. Replacing the control is what clears that lock, and the suggestion missed it.

What the letter-spacing move does change is that the reservation no longer has to ride the replacement path. With measure(copyTrigger, () => reserve(copyTrigger, COPY_WORDS)) in #buildActions after this.#copy.append(copyTrigger), and the cheap path guarded on the in-flight state as well as the two feedback states:

if (this.#copy.value === instruction) return;
if (
  !this.#copy.isCopying &&
  !this.#copy.matches(":state(success), :state(error)")
) {
  this.#copy.value = instruction;
  return;
}

the trigger still carries min-width: 141px from load, unchanged from this head, and typing four characters into title replaces the control 0 times instead of 4. The 13 playground cases pass, this one included.

One caveat on that shape: isCopying is Web Awesome's own reactive property rather than part of its declared surface, so a rename upstream makes the guard quietly false and returns the stale-feedback case these new assertions cover. Owning the flag here instead — set when the slotted trigger is pressed, cleared on wa-copy and wa-error — keeps the guard off upstream internals for the cost of a listener pair. Happy to push either.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy button's hardcoded width replaced a measured reservation, and the constant is already spent.

.lf-playground-copy-trigger in theme.css declares width: 8.5rem — 136px — and the same change dropped measure(this.#copy, () => reserve(this.#copy, ["Copy instruction", "Copied"])) from #buildActions, along with the measure and reserve imports. reserve() in widget-elements.js is the layer's primitive for exactly this control: it stands the element out of flow, measures it against each label it will wear, and pins min-width to the widest. banner.js (Approve version / ✓ Version approved) and interaction-gallery.js still reach for it.

Measured on the PLAYGROUND_PAGE fixture at this head, with the trigger cloned at width: auto and each label shown in turn: Copy instruction needs a 140.75px border box, Copy failed 106.77px, Copied 78.55px. The widest is 4.75px past the 136px declared, so the resting label eats into its own var(--sp-3) padding today, at the shipped 600 11.5px system-ui. With white-space: nowrap there is nowhere for the next increment to go — a theme that moves --t-6 or --sans, or a browser falling back to a wider system font, spills the words past the padding rather than growing the button.

That also leaves assert copy.bounding_box() == before in test_a_playground_preset_reset_copy_and_narrow_layout_share_the_same_state passing for a different reason than the one it names: the box is stable because the width is declared, not because the labels fit inside it.

Putting measure/reserve back on the slotted trigger — three labels now, not two — and dropping width: 8.5rem returns the rule to where the layer states it once. Happy to push that if you'd like it in this PR.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label reservation is reachable only through #syncCopy's control-replacement branch. measure/reserve run inside the updateComplete callback scheduled after previous.replaceWith(this.#copy), so the widest-label width is a side effect of replacing the copy button rather than something the trigger holds.

That leaves this fix and the open thread on the same method mutually blocking. Returning early when there is no feedback to clear takes away the only path that reserves. Moving the reserve to #buildActions on its own does not rescue it either: the first #syncCopy still replaces the control, so the trigger measure() observed is detached before it ever draws, its ResizeObserver never fires, and the take is never delivered — measured at this head, the trigger ends with no min-width at all. The two work only together, and together they also drop the re-measure the current placement performs per keystroke on a value the clone already carries.

What needs your call is what the test's letter-spacing injection stands for. It widens the trigger's face after the control exists, so it passes only because the reservation is retaken on the next instruction change; a reservation taken once at build measures the narrow face and the assertion fails at 141 against 172.75. skills/leaf/assets/CLAUDE.md asks for a re-measure "after changing type tokens" and this widget has no such hook — if that is the behaviour the case means to pin, it belongs on a stated hook rather than on the instruction path. If it is only a way to get a wider face under the measurement, applying it before the reservation is taken lets both fixes land.

Happy to push whichever shape you pick.

Measurements on the PLAYGROUND_PAGE fixture at this head

Served by the test harness on this branch, reading the trigger's style attribute rather than its computed box, so the reservation is visible whether or not it happens to match the natural width.

  • The clone already carries it. A MutationObserver on .lf-playground-actions reports each replacement's trigger at insertion. Typing four characters into the title control gave ['min-width: 141px;', 'min-width: 141px;', 'min-width: 141px;', 'min-width: 141px;'], and each of the four re-measures landed on 141px again. A colour drag repeats that per pointer move.
  • Build-time reserve alone delivers nothing. With measure(copyTrigger, () => reserve(copyTrigger, COPY_WORDS)) in #buildActions and #syncCopy restored to focus-only, the trigger's style attribute is None both at load and after typing — the observed node was replaced before it drew.
  • Both together hold. Adding the open thread's early return on top gives min-width: 141px at load and the same after typing, with no replacement in between.
  • And then the new case fails. In that combination test_a_playground_preset_reset_copy_and_narrow_layout_share_the_same_state asserts 141 == 172.75 at copy_width("Copied") == reserved_width, because the inline letter-spacing lands after the reservation was taken. The other twelve playground cases pass.

@max-sixty max-sixty changed the title Add Web Awesome controls to playground Use Web Awesome controls across interactive widgets Sep 21, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings hold the verdict; the inline notes are smaller.

Every page now carries 53 KB of Web Awesome theme in its render-blocking theme.css. build_webawesome writes the generated sheet to skills/leaf/packages/default/shadow.css, and resolve_packages in layer.py refuses a default selection with package 'default' is already included in every page — so that root is in every page's layer. composed_sheets appends each root's shadow.css to the document's theme.css as well as to the composed shadow.css, and http.py links theme.css as a blocking stylesheet. Composing the layer for a page that selects no packages at all: theme.css 300,770 → 353,919 B, and the composed shadow.css 43,285 → 96,434 B, the second parsed again in each declared shadow tree as a fresh <style> (shadow-stage.js). On that page the whole block is @scope (:is(wa-color-picker, …)) over elements the page never contains.

The JavaScript half honours the rule this breaks. CLAUDE.md, under The install runs this tree: "A bundle lives in the package whose widget imports it, so a page that never draws a diagram or a diff never vendors their renderers." The four widgets import vendor/webawesome.esm.js themselves and a page without them loads none of it; the generated CSS goes everywhere instead. The description's startup profile and its "must upgrade before authoritative presentation" answer to Working on the repository are about the playground page, and neither reaches a page that has none of these controls.

Nothing in that sheet can paint before upgrade in any case. Every host is built through offer(), so it wears .lf-ui, and assets/theme.css holds html[data-lf-live] body:not([data-lf-upgraded]) > main .lf-ui { visibility: hidden !important; }, with the matching :host-context rule in SHADOW_STARTUP_CSS for shadow trees. So the sheet can travel with the bundle that already loads on demand — adopted into the document and each shadow root at import — instead of sitting in the always-composed layer sheet.

undeclaredShadowRoots no longer reports a widget that only ever appears inside conversation markup. The new exemption is !inUi(el), and inUi is the unbounded reading; shadow.js states what that costs where it defines the pair: "the panel holding a widget an agent sent in a reply is itself .lf-ui, so asked the unbounded way every child of such a widget answers yes". thread-card.js puts lf-ui on .lf-conversation-thread, so a widget an agent sends in a reply, and never places in the page body, now passes the check whose whole job is to keep an undeclared root from anchoring quotes astray. render-checks/layout.js already reaches for the bounded uiInside(el, main) for this reason.

Measured: a custom element with an undeclared open shadow root, appended under <div class="lf-conversation-thread lf-ui"> inside main, reports ['<demo-widget>'] at the merge base and [] at this head.

The exemption wants the element itself, not an ancestor search: offer() already writes data-lf-gen="1" on everything it builds, which is exactly the set the check means to exempt. The one thing blocking that today is wa-option — on the targeting gallery at this head, nine of them have shadow roots and no marker, because option() in lf-targeting.js and #createCase in lf-visual-review.js build them with document.createElement. The two inline suggestions close both together.

How both were measured

Stylesheet sizes, from composed_sheets over layer_inputs(()) — the kernel and default, no selected packages — at this head and at the merge base 00202e82:

                 base       head      delta
theme.css     300,770    353,919    +53,149
shadow.css     43,285     96,434    +53,149

The gate reading, run through the browser harness on a leaf_page at each of the two commits:

customElements.define('demo-widget', class extends HTMLElement {
  constructor() {
    super();
    this.attachShadow({mode: 'open'}).innerHTML = '<p>Shadow words</p>';
  }
});
const panel = document.createElement('div');
panel.className = 'lf-conversation-thread lf-ui';   // thread-card.js:156
panel.append(document.createElement('demo-widget'));
document.querySelector('main').append(panel);

evaluate_probe(page, "undeclaredShadowRoots", {}) returns ['<demo-widget>'] at 00202e82 and [] here; inUi(widget) is true at both.

The unmarked options, on the built targeting-gallery: [...document.querySelectorAll('*')].filter(el => el.shadowRoot && el.dataset.lfGen !== '1') returns nine wa-option nodes here and none on visual-review-gallery.

Test selection run against the diff's product paths, all passing: the two new cases in test_render_gate.py and test_render_navigation.py, the playground, targeting and visual-review cases in test_render_widgets.py, test_render_visual_review_journey.py, the playground offline-export case, and test_playground_joins_initial_widget_settlement.

Comment thread tests/test_render_widgets.py Resolved

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings; the inline notes are smaller.

The cascade layer the description calls out has no test. test_webawesome_theme_loads_only_with_its_controls closes on --wa-form-control-border-color == --muted, labelled "the package theme must outrank the lazy vendor defaults", but specificity settles that comparison rather than @layer lf-vendor: the playground's .lf-playground-toggle > wa-switch is (0,1,1) against the generated sheet's :is(wa-color-picker, …, wa-switch, …) at (0,0,1). Measured on PLAYGROUND_PAGE at this head — appending an unlayered copy of that same vendor rule as the document's last <style> leaves the computed value at --muted. So build.mjs could lose the @layer lf-vendor{…} wrapper and this case would still pass, while every page rule below (0,0,1) quietly started losing to the vendor defaults. A rule with no specificity at all is the discriminating shape; the inline suggestion is one, and it passes here.

The startup profile in the description predates this commit. "165 requests / 2,955,277 decoded bytes for the candidate versus 164 / 2,527,382 on the base: one request and 427,895 bytes are added before presentation" was read on the head before this one. This commit deletes the generated skills/leaf/packages/default/shadow.css (53,149 B) and carries the same text inside the vendor module instead (369,842 → 423,193 B). Composing the layer for a page that selects no packages gives theme.css 300,770 B and shadow.css 43,285 B here, against 353,919 and 96,434 at the previous head — so the render-blocking sheet loses 53,149 B on every page, only a page that imports a Web Awesome widget pays them back, and it pays them once rather than twice. The playground reading in the body now understates the change by about 53 KB, and a page with none of these controls is 106,298 B lighter than the body implies. CLAUDE.md's Working on the repository asks for the base/candidate comparison on a change that can alter browser startup, and the description is main's commit message for this one.

Comment thread tests/test_render_widgets.py Resolved
@max-sixty
max-sixty merged commit 725fca7 into main Sep 21, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/playground-webawesome-controls branch September 21, 2026 14:54
max-sixty pushed a commit that referenced this pull request Sep 21, 2026
…ontrols (#884)

`ci` on `main` went red at 725fca7 (#878): [`lint` and `test` passed
and the complete suite in `nightly` failed on seven
cases](https://github.com/max-sixty/leaf/actions/runs/35615354769). One
of them,
`test_agent_status_leaves_the_margin_transcript_where_the_reader_scrolled_it`,
also fails at 9b17c79 and is #879's; #883 has since landed it. The
remaining six are the Web Awesome rollout's, and they share one cause:
the rollout moved four packages' controls into a vendor's shadow root,
and the facts Leaf had stated about the native elements it replaced
stayed on the hosts those elements used to be. #878's stated validation
was 177 widget browser tests and the shipped runtime tests, and neither
reaches the corpus ring floor or the published site.

## What the reader sees

**The band is the vendor's, not the layer's.** `theme.css` keeps the
ring's thickness in one token so there is one band on the page. A
vendored control's ring is painted inside its own shadow root from
`--wa-focus-ring-*`, which the Leaf theme did not map, so every vendored
control wore a 3px ring next to Leaf's 2px one — and the diff filter
field's own rule, `.lf-diff-search:is(:focus-visible, …)`, stopped
matching anything at all, because a `wa-input` host is neither the Tab
stop nor the box that gets ringed. The vendor also transitions
`outline-color`, so the band faded in over 75ms rather than appearing
with the focus; `theme.css` states the opposite for the layer's own
rules, and a transition in flight is reported as the value the property
is leaving, so the band was invisible to any reading taken when it was
drawn.

The shared theme now states the band — `--wa-focus-ring-style`,
`--wa-focus-ring-width: var(--here-ring-w)` beside the
`--wa-color-focus` mapping that was already there — draws and names it
on the text field's own part, since `--lf-here-ring` does not inherit,
and drops `outline-color` from the two vendored controls that transition
it. That is one place for every package rather than a rule per host. The
diff package loses its dead filter-field rule, and the duplicate
`.lf-diff-wrap:focus-visible` #878 added beside the named one — the
second latent failure, which the corpus floor reached only once the
first was fixed.

**The chrome above the evidence grew.** `lf-visual-review` gives a
focused review a laptop's height, and both rows of chrome above the
evidence take their height from the tallest control in them. A vendored
control sizes itself from the vendor's form-control height, eight pixels
more than `.lf-btn`'s box, so the queue row and the inspector row each
grew by eight and the evidence stage lost sixteen — 366px to 350px,
under the 360px the workspace states. The package states those controls'
height again, as it did before #878 with `.lf-vr-inspector-button {
min-height: 30px }`. Measured on the rebuilt page: both rows back to
30px and the evidence back to 366px.

## What the tests were reading

`test_site.py` still read a `wa-slider` through `to_have_value` and
drove a `wa-select` with `select_option`; both now use the shapes #878
established in `test_render_widgets.py`. The corpus ring specimen named
the `wa-input` host, which is not in sequential keyboard navigation; it
now names the field the reader actually stands on, and a second specimen
keeps `diff-tools` exhibited for the controls that still wear it.

`test_a_copy_speaks_reader_origin_after_live_map_is_removed` is not a
Web Awesome failure. It asserts the card move's optimistic paint and
then closes the page — but the paint says nothing about the log, and the
export opens its own page with only the log to replay from, so a send
still in the wire is aborted by the close. That is the arrangement
`sending()` exists for, under **State races are arrangements, not
probabilities** in `tests/CLAUDE.md`; the gesture is now enclosed in it.
Nothing says #878 introduced it: the two failing `main` runs before this
one carry only the margin case, so this reads as a latent race that the
run lost.

## Two more the floor could not reach

The corpus ring floor raises inline on the first specimen it cannot
stand on, so it reports one per run and fixing one uncovers the next.
Behind the diff filter field, two had collected, and this branch takes
both because `main`'s `nightly` stays red on that case otherwise.

`lf-shot` upgrades to `wa-comparison` after presentation, and
`theme.css` shows the native checkbox only while no comparison is
mounted, so `lf-shot > input.lf-shotflip` — the control `RING_CASES`
named — is `display: none` on every live page. The reader's stop is the
comparison's own handle, which wears Leaf's band because the host maps
`--wa-focus-ring` to it, and wears the `shot` name because #892's
`#paint()` writes `--lf-here-ring` onto that shadow element inline —
`--lf-here-ring` is registered `inherits: false`, so the host's own
declaration does not reach it. The specimen moves there. That is #892's,
and the same shape as the diff field: a vendored control took over and
the reading stayed on the element it replaced.

The summary range's expand and refold controls draw the here ring and
declare no `--lf-here-ring`, which `chrome.css`'s own header forbids.
That is #886's. They share one rule, so they take one name,
`summary-fold`, and one specimen on the gallery's summarized thread.

The walk collecting its per-specimen failures the way
`test_every_base_corpus_tab_stop_has_a_visible_focus_indicator` collects
its own would have shown all three in one reading. That is a change
against the test rather than against this one, and nothing here makes it
harder.

## Verification

All six cases pass here, and so do the nightly files they live in or
that the theme change could reach: `test_render_widgets.py`,
`test_render_visual_review_journey.py`, `test_render_projection.py`,
`test_render_controls.py`, `test_render_navigation.py`,
`test_render_anchors.py`, `test_render_gate.py`, `test_site.py` — 881
passed, beside two `test_render_export.py` cases that fail in this
sandbox for a reason named below and fail identically without this
change. `pre-commit run --all-files` is clean, `npm run test:runtime` is
28 passed, and the Web Awesome regeneration is `scripts/vendor.py
webawesome` rather than a hand edit of the bundle. That reading was
taken at 4bfc53f; with `main` merged in and the two cases above taken,
`tests/test_render_controls.py -k "ring or focus_indicator"` is 21
passed and `tests/test_render_conversations.py` is 96 passed, both
`--run-nightly`.

## What this does not do

The height fix is the visual review's own, because that is the package
whose layout contract broke and where the metric was stated before. The
general question — whether the shared theme should state the vendored
control's box, so any vendored control matches the Leaf button beside it
— is left open: taking it here would move the playground, targeting and
diff geometry that #878 reviewed, with no failing case to read the
result against. Nothing in this change makes that harder to do later.

It does not settle what `shot` is declared by. `RING_NAMES` reads
declarations off stylesheets, so that name's whole population entry
stays `lf-shot:has(> input.lf-shotflip:is(:focus-visible,
.lf-focus-visible))` — a rule whose control is `display: none` wherever
the comparison mounts — while the credit comes from the handle's inline
property. The two halves the floor compares agree on a string rather
than on a rule for that one name. Putting the declaration where the
paint is, `::part(handle):focus-visible` drawing and naming the band
with the `#paint()` write dropped, is the repair; it is left out here
because it answers for `lf-shot` the question this PR leaves open for
the other vendored families, and the corpus floor reaches its end
assertions either way.

<details><summary>The failing cases and where each was read</summary>

From [the `nightly` job at
725fca7](https://github.com/max-sixty/leaf/actions/runs/35615354769):

```
FAILED tests/test_site.py::test_the_published_notification_example_runs_its_authored_module@site
  AssertionError: Locator expected to have Value '2' / Error: Not an input element
FAILED tests/test_site.py::test_published_visual_evidence_loads_from_its_page@site
  Locator.select_option: Error: Element is not a <select> element
FAILED tests/test_render_controls.py::test_every_base_corpus_tab_stop_has_a_visible_focus_indicator
  keyboard stops with no visible indication: pr-walkthrough: input#input.control [outline none, shadow none]
FAILED tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
  .lf-diff-search in the page of pr-walkthrough is not in sequential keyboard navigation
FAILED tests/test_render_export.py::test_a_copy_speaks_reader_origin_after_live_map_is_removed
  Locator expected to have attribute '1' / Actual value: None
FAILED tests/test_render_projection.py::test_visual_review_gallery_gives_a_laptop_to_the_evidence
  assert 350.421875 >= 360
FAILED tests/test_render_margin.py::test_agent_status_leaves_the_margin_transcript_where_the_reader_scrolled_it
  assert {'working': [484, 980]} == {'working': [484, 959]}      # #879's, landed in #883
```

Five of the six reproduce here on `main`. The export case does not — it
passed on three consecutive local runs — and was diagnosed from the
arrangement rather than from a local red.

The band's own reading, taken on the focused diff filter field before
the transition was removed: `outline-width` 2px and `--lf-here-ring`
`text-entry` from the new rule, with `outline-color` still `rgba(0, 0,
0, 0)` because the vendor's `outline-color` transition had not run. That
is what made the rule look inert and is why the transition is part of
this change rather than a separate one.

Two cases in `test_render_export.py` fail in this sandbox —
`test_the_example_preview_command_exports_a_file_that_opens_on_its_own`
and `test_exporting_an_example_leaves_the_live_preview_untouched` —
because a subprocess cannot launch Chrome here. Both fail identically at
9b17c79 with this change absent, and neither is in the hosted run's
failure list. The everyday suite's five failures here are the same
sandbox's `AF_UNIX` and umask limits, as [#883
recorded](#883).

Catalog previews are not affected: the resting appearance of a vendored
control is unchanged everywhere except the visual review, which the
catalog does not carry, and a still has nothing focused.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 21, 2026
`ci` on `main` went red at f3de402 (#881): [`lint` and `test` passed and
the complete suite in `nightly` failed on seven
cases](https://github.com/max-sixty/leaf/actions/runs/35616173899). Six
are #884's, unchanged from [the run before
it](https://github.com/max-sixty/leaf/actions/runs/35615354769) and
still open there. The seventh is this one, and it is not #881's: that
commit moves the Pierre diff bundle and its pin, and the binding-badge
fixture draws no diff.

`test_ask_binding_badges_do_not_cover_their_key_line` failed with the
shape #876 repaired — the badge the test scrolls one pixel into the
shortcut bar's band still worn, count 2 rather than 1, stable across all
fourteen polls.

## What the wait could not see

Stillness is half a reading. A page that has not begun an effect is
indistinguishable from one that finished it when the only evidence is
the scroll number holding still, which `tests/CLAUDE.md` already states
under **A wait consumes a fact the system states**.
[`goToAskNow`](https://github.com/max-sixty/leaf/blob/cf0c6cf185346c5e68a392b176578c4d1f4d0466/skills/leaf/assets/runtime/asks/view.js#L1115)
awaits `materializeAsk` and one or two `reveal`s before it issues any
travel, so `scroll_settled` called straight after the press can count
its three still frames on a page the walk has not moved yet. The test
then measures its geometry where the walk began, issues its own
`scrollTo` from there, and the travel lands on top of it — the badge
back above the bar, legitimately kept, for the rest of the assertion's
timeout.

#876 changed the unit and not the ordering, and the measurement says it
addressed the smaller window. On the ask walk here the glide pause is
nought to one frame and holds at nought under
`Emulation.setCPUThrottlingRate`, because the compositor starts the
glide on the frame after the instant move whatever the main thread is
doing. The window that grows under load is the asynchronous gesture
before the travel is issued at all, which is main-thread work; no count
of frames bounds it, so raising the count would have been the next
wording rather than the fix.

## What this changes

The walk arrives and then travels, in that order and in one task —
[`arriveAt`](https://github.com/max-sixty/leaf/blob/cf0c6cf185346c5e68a392b176578c4d1f4d0466/skills/leaf/assets/runtime/asks/view.js#L936)
focuses, `scrollToElement` follows with no await between — so the
arrival is a fact the stillness can be read behind. Each press in this
test now waits on its ask's focus before `scroll_settled`.

That is the rule the rest of the suite already keeps. This was the only
one of the suite's 38 `scroll_settled` call sites that read stillness
with nothing stated before it: every other waits on a moved scroll
number, a painted `data-lf-ask`, a URL, `to_be_in_viewport`, or the
focus. So the durable half of the change is in the helper's own contract
and in `tests/CLAUDE.md`, which said the helper "waits for a scroller to
have arrived" — a promise it cannot keep — and now says it waits for one
to have stopped and is asked behind the fact that it started. The
frames-versus-milliseconds reasoning #876 established stays; what it is
for is now named as the glide, not the gesture.

## Verification

The mechanism reproduces on demand: with the stillness wait allowed to
answer early (`frames=0`), the page ends at the travel's own position
rather than the test's, with the badge worn and the count stable at 2 —
the run's failure exactly. The two windows were measured separately on
the ask walk at throttling rates 1, 2, 4 and 10; the glide pause reads 0
frames at every rate and the press-to-travel window is the one that
carries the slack.

`tests/test_render_widgets.py --run-nightly` is 179 passed, `npm run
test:runtime` 28 passed, and `pre-commit run --all-files` clean. The
everyday suite is 1195 passed beside six cases that fail in this sandbox
and fail identically at the merge base — an `AF_UNIX` socket it refuses,
a umask it does not grant, and a Node bundle step it cannot run.

## What this does not do

The six Web Awesome cases stay with #884; nothing here touches them, and
`nightly` stays red until that merges. `scroll_settled` keeps its
signature: the ambiguity it carries is not one the helper can settle
from outside the page — a gesture that legitimately moves nothing looks
the same as one that has not started — so the caller consuming a stated
fact is the fix rather than a way around it.

<details><summary>The failing cases and where each was read</summary>

From [the `nightly` job at
f3de402](https://github.com/max-sixty/leaf/actions/runs/35616173899):

```
FAILED tests/test_render_widgets.py::test_ask_binding_badges_do_not_cover_their_key_line
  Locator expected to have count '1' / Actual value: 2
  14 × locator resolved to 2 elements                            # this change

FAILED tests/test_site.py::test_the_published_notification_example_runs_its_authored_module@site
FAILED tests/test_site.py::test_published_visual_evidence_loads_from_its_page@site
FAILED tests/test_render_controls.py::test_every_base_corpus_tab_stop_has_a_visible_focus_indicator
FAILED tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
FAILED tests/test_render_projection.py::test_visual_review_gallery_gives_a_laptop_to_the_evidence
FAILED tests/test_render_margin.py::test_agent_status_leaves_the_margin_transcript_where_the_reader_scrolled_it
                                                                 # the six in #884
```


`test_render_export.py::test_a_copy_speaks_reader_origin_after_live_map_is_removed`,
the seventh in the 725fca7 run, passed here — consistent with #884
reading it as a latent race rather than #878's.

The badge test passed 18 consecutive local runs before this change,
including ten under six busy cores, so the window is not one an idle
machine reaches. What reproduces it is letting the wait answer early,
which is what the loaded runner does.

</details>

Co-authored-by: leaf-agent <[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.

2 participants