Repository navigation
Hold the interaction gallery's playback row still and name its focus ring - #353
leaf-agent wants to merge 1 commit into
Conversation
The live interaction gallery (#341) left three nightly readings red. The playback row it injects is a control row the corpus had no archetype for, and the row genuinely reflows: the toggle says Play, Pause and Played at three widths with Replay standing beside it. Reserve the widest word on the toggle and on the status line, the way the banner reserves its own counts, and declare the row as an archetype with a causal case in the control-stability fixture. The gallery page drew the here ring on its own controls and named no rule, so the corpus floor divided by a population short of it. The layer's pressable floor already draws and names that ring for anything `offer` builds, so the page rule only shadowed it; drop it. The gallery's Asks and versions also grew, so the feature gallery's core-surfaces walk counts twelve asks and three version rows. The demo scenarios found their specimens by the gallery page's own ids. They now read them off the stage they are played on, so the fixture that proves the row's stability stages its own suggestion.
|
The same three readings took Two things worth knowing since this branch was cut: |
leaf-agent
left a comment
There was a problem hiding this comment.
One finding, on the second reservation rather than the first.
reserve(status, …) fixes a min-width measured once at install, and the widest string it measures is the reduced-motion sentence — 425px on the gallery page, 518px in the composed corpus. A min-width is a floor a flex item cannot shrink below, and nothing renews it across a width change (the banner's reservations are renewed across a breakpoint for exactly this reason — widget-elements.js's own note names that case). So a reader who loads the gallery wide and then narrows the window gets a page that scrolls sideways.
Measured on this branch's merged tree, examples/developer/feature-gallery.html served and loaded at 1200px, then narrowed to 390px: document.documentElement.scrollWidth 449 against clientWidth 390, with the status still 425px wide inside a 342px row. Loading straight into 390px is fine — the shrink-to-fit measurement is capped by the containing block — so it is only the narrowing path. test_the_interaction_gallery_drives_real_widgets already reaches that state (page.set_viewport_size({"width": 390, …})) and just never reads the document's sideways scroll, which is why the suite stays green.
The reservation also isn't buying the row anything: status is the last child of .interaction-controls, so no control stands beside it. With min-width forced to 0px and the toggle's reservation left alone, the toggle and Replay hold at x=288 and x=401 across every word the status can say — Ready, Playing, Paused, Complete, both panel labels — and the row height stays 28px. Dropping the status reservation and keeping the toggle's would close the overflow without touching what the PR is for; renewing both across a width change is the other route.
What I checked and how
The toggle's reservation is load-bearing: with reserve(toggle, …) commented out, test_each_control_archetype_holds_its_neighbours_still[demo-playback] fails with button.interaction-control.lf-ui "Replay" moved by [18, 0, 0, 0]. That half of the change does what it says.
The three originally-red readings pass on the merged tree, together with the whole test_each_control_archetype_holds_its_neighbours_still parametrization — 12 passed, --run-nightly.
The removed page rule is safe to remove: the floor at [data-lf-offer]:where(:not([data-lf-offer=""])):is(:focus-visible, .lf-focus-visible) in theme.css declares the same outline: var(--here-ring) and outline-offset: var(--here-ring-gap) and names --lf-here-ring: pressable, and offer("button", …) writes data-lf-offer="button", so the toggle and Replay are inside it.
placedIn reproduces the placements it replaces on the gallery's one-card, two-column board — first column at rest, querySelectorAll("lf-column")[1] as the destination — and examples/corpus.html carries no copy of the page's <style>, so no corpus regeneration is owed by the CSS deletion.
The status reservation numbers above were read with a scratch test against render_support's serve/open_page, deleted afterwards.
| // the longest thing they can say, so a press never moves the control beside it — the | ||
| // reservation the banner makes for its own counts, for the same reason. | ||
| reserve(toggle, Object.values(TOGGLE_WORDS)); | ||
| reserve( |
There was a problem hiding this comment.
This reservation is the one that costs something. Measured at 1200px it fixes min-width: 425px on the status (518px in the corpus, whose widest label is longer), and nothing re-measures it when the window narrows — so at 390px the status still holds 425px inside a 342px row and the document scrolls sideways (scrollWidth 449 vs clientWidth 390).
And nothing stands beside it to hold still: status is the last child of controls. With its min-width zeroed, the toggle and Replay keep x=288 and x=401 across every word it can say and the row height stays 28px, so the toggle's reservation above is carrying the whole invariant on its own.
|
Same three readings again on run 34058747810 ( That run went red on five readings rather than three. The other two — The first of those two is the reading this PR's own body set aside as environmental to its container. It is not: the |
…ings (#358) ## Problem The nightly leg of [`ci` on `f5d4fac`](https://github.com/max-sixty/leaf/actions/runs/34058747810) went red on five readings. Three are the live interaction gallery's and are already fixed in #353. The other two are this PR's, and neither comes from that commit's diff — each is a reading taken while its page was still moving. `test_a_selected_question_keeps_one_action_context_while_tab_reaches_its_field` — the `a` arrival is a glide, and the three Tab presses go in while it is still running. The measurement lands mid-flight: sampled here at `scrollY` 1574 with the field 13.4px from the line, while the glide goes on to 1726, where it stands 165px clear. Reproduces on `8bf8154` on this runner every time. CI has read 11.4px and #353 read ~1.5px from the same assertion, which is the same fault sampled at three points of one animation. `test_a_draft_that_outlives_its_passage_returns_with_that_passage` — the test selects its passage after `#p` arrives in markup, which is well before the page is presented. `presentPage` restores a standing draft into the composer and that restore focuses the field; normally it runs before the click, the click blurs it, and the assertion passes. Under load the click gets there first and the restore's focus lands on a field the test has already read. Reproduced 1 in 8 with four spinners running, and a wrapped `HTMLElement.prototype.focus` names the caller in every run: `openComposer` ← `presentPage` (`skills/leaf/assets/leaf.js:132`) ← `readAndPresent`. ## Solution Both are the class `tests/CLAUDE.md` owns under **A state the page passes through is not a state to poll for** — state the ordering rather than repeat the gesture. The options reading asks the arrival for no motion at all: `page.emulate_media(reduced_motion="reduce")` before the press makes `scrollBehavior()` return `instant`, so both of `goToAsk`'s document scrolls — the instant reveal and the glide onto the region — land inside the press and there is no settling frame for the Tab presses to race. It also stages the ask in a 390×640 window instead of 390×844, and asserts the field is under the line before the presses: with the whole ask on screen after the arrival the Tab stop needs no travel at all, so the old reading went green over the scroll it is about. Checked against that — with `scroll-padding-bottom` forced to 0 the browser leaves the field 38.6px under the line, and with it the field lands 224px clear. The outbox reading goes through `navigate`, which waits on the page's three readiness stamps, so the selection is a gesture the reader could actually have made. ## Testing - `uv run pytest tests/test_render_options.py tests/test_render_outbox.py --run-nightly` — 87 passed - `uv run pytest tests` — 898 passed, 6 skipped - each repaired reading 6× on its own under four spinners: both stable - bug-back on the options reading with `scroll-padding-bottom` forced to 0: fails at `landed >= 20` by 38.6px - `pre-commit` on the changed files <details><summary>Why not a `scrollend` wait</summary> The first version of the options fix waited for the document's own `scrollend`, copying the block in `test_render_controls.py`. That wait returns at the arrival's *first* rest, and an unframed page ask has two document scrolls: `scrollToElement(next, "instant", "nearest")` to reveal it, then `scrollToElement(region, scrollBehavior(), "start")` for the arrival proper. The instant one fires its own `scrollend`, so the wait is satisfied in the window before the glide's first frame. Measured at 390×844 it returned at `scrollTop` 1559 while the glide ran on to 1726. The block it was copied from pairs that wait with the mark reaching its computed destination, which is what makes it a wait on the *final* scroll; the pairing did not come across. It did not fail at 390×640 only because that height happens to make the arrival a single instant scroll — so the reading was held still by the window, not by the wait it claimed to stand on. </details> <details><summary>One seam this did not fix</summary> The restored composer stands only because it takes focus. `updateFab` ends with `else if (fabAnchor?.quote && !fabHoldsCapturedPassage()) showFab(null)`, and after a reload there is no page selection, so the field holding focus is the only thing keeping the bar up. Passing `focus: false` at [`leaf.js:132`](https://github.com/max-sixty/leaf/blob/a516990baeca35044a40b90ee3e6dc60dfc64adb/skills/leaf/assets/leaf.js#L132) does stop the restore taking a keyboard the reader never gave it — a reader who picks a passage out while the page is starting gets their cursor moved into a box they did not open — but it also takes the restored box down: `test_the_composer_never_stands_on_its_own_mark` then finds `.lf-fab-bar` at `display: none`. Giving a restored draft its own hold on its passage is a change to what keeps that bar standing, so it is not in this PR. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34058747810) --------- Co-authored-by: leaf-agent <[email protected]>
Three nightly tests have been red on `main` since #341, and nightly runs after `main` moves, so PR CI and `wt merge` both stay green while nobody sees them. All three are the same seam: the live interaction gallery injects its playback row from the runtime and leaves the authored page owning it. **The ring census.** The page drew `outline: var(--here-ring)` on the injected presses without naming the ring, so the floor below divided by a population short of it. It was drawing the ring twice over: `offer` marks those buttons `data-lf-offer="button"`, so the theme's pressable floor already carries the hand, the hover tint, the disabled treatment, and a ring that names itself. The page's copies are gone and the floor's answer stands alone. No other authored page in the corpus draws the layer's ring. **The control-row sweep.** The row is a control row nothing had declared. Declaring it means proving it holds still, and it did not: the toggle rewrites its own word as a demo runs — Loading…, Play, Pause, Played — so pressing Replay moved the button beside it, and the live status line changed length on the same line as both presses. The toggle now reserves the width of every word it can say, through `reserve`, the layer's own helper, called where the runtime builds the row — `scripts/corpus.py` copies each source's `<main>` and none of its `<head>`, so a rule in the gallery's head would not reach the generated corpus, which is the page this sweep actually walks. The status line stands under the two presses at every width rather than only on a phone; reserving its width instead would hold the row open at the width of its longest sentence. `interaction-playback` is the new archetype; an archetype may now name an `example`, because a demo is a scenario the module names rather than markup the synthetic stability page can compose, so its proof runs on the gallery itself. Replay is the press for the same reason the diff's review press is: the button that has to hold still is the toggle, and pressing Replay is what sends it through every word it has. **The injected-surfaces walk.** The gallery's own counts had moved on: #341 added a live undecided suggestion and a second stored version, and merging `main` brought the playground package's ask, so the walk now sees thirteen asks and three version rows. `tests/test_site.py` asserted the status line's `margin-left: 0` at 390px, which the layout change makes vacuous; it now reads the invariant that replaced it. ## Checks `uv run pre-commit run --all-files` is clean, and `uv run pytest tests --run-nightly` passed whole — 2096 tests — on this branch before `main` moved under it. On the merged tree that full run reports 11 failures. A paired control, a detached checkout of `ca4ac82d` with none of this branch on it, fails 10 of the same tests, so they arrived with the eight PRs that landed while the first run was going. The eleventh, `test_a_failed_preview_bootstrap_hears_the_replacement_server[theme.css]`, passes on its own here and on the control: a flake in a 27-minute run. The three tests this PR is about pass. Nightly is red on `main` for two reasons this PR does not reach, both worth someone's attention: - the playground package's Reset, Copy instruction and Apply card share rows and match no archetype, so `test_the_composed_corpus_declares_every_control_row_archetype` fails on `main` for that reason now instead; - `.lf-resolve.lf-icon-action` (#347) has the left edge of its focus ring under `.lf-react-trigger` (#349) in the ship-review thread, two independent PRs whose rows now overlap by two pixels, which `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` reports as 2 faults over 714 stops. Plus pre-existing reds in `test_render_anchors`, `test_render_export`, `test_render_projection` and `test_render_widgets`, all present on the control. **#340 is the standing fix for the shape of this: nightly modules a PR touches never run before it lands. ## Overlapping PRs **#353 repairs the same three readings, and opened while this branch's first suite was running. It took the `reserve` route from the start, which is where this one has now arrived; it also rehomes the scenarios' `#bg-motion-*` lookups onto the stage, which this does not. One of the two should close, and which is Max's call. ## Note for #351 **#351 deletes this same block of gallery CSS and rehomes none of it, which would leave the injected buttons without their pill shape or their `--aim-floor` aim target. Whichever lands first, the other conflicts here. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q7ZBoNLYxFVhWgDsXH1RTx --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
Superseded by #359, which merged as Two things this branch carried that main does not, recorded rather than reopened:
|
Problem
The nightly leg of
cion59f222awent red on three readings, all from the live interaction gallery (#341). Each reproduces deterministically on that commit.test_the_composed_corpus_declares_every_control_row_archetype— the playback row the gallery injects is a control row the corpus has no archetype for (Features: button "Play": no archetype), and the row really does reflow: the toggle saysPlay,PauseandPlayedat three widths withReplaystanding beside it.test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus—.interaction-gallery .interaction-control:focus-visibledrew the here ring and named no rule, so the floor below it divided by a population short of that rule.test_the_feature_gallery_exercises_the_injected_core_surfaces— the gallery's new suggestion is a twelfth ask, and (behind that assertion, so CI never reached it) its preserved v2 is a third version row.Solution
The toggle and the status line reserve the width of the longest thing each can say, through the layer's own
reserve— the reservationbanner.jsalready makes for its own counts. The row then holds still across a demonstration: measured on the gallery page, the toggle stays 105px fromPausethroughPlayedandReplaykeeps its x. The status becomes a box rather than a run of words, becausemin-widthis nothing to an inline element and the row is a flex line only where the page that stages the gallery says so; it keeps itsoffermarker, so the standalone bake still takes it away.CONTROL_ARCHETYPESgainsdemo-playback, with a causal case inCONTROL_STABILITY_PAGE. The fixture stages the gallery at the foot of the page, off screen at rest, because a gallery that has already started playing is not the resting row the sweep presses.The page's own ring rule is removed rather than named:
theme.css's pressable floor already draws that exact ring, with--lf-here-ring: pressable, for anythingofferbuilds — the page rule only outranked it and dropped the name.The two demo scenarios found their specimens with document-wide
#bg-motion-*lookups. They now read them off the stage they are played on, so the module is not a second place the gallery page's ids are written down and the stability fixture can stage a suggestion of its own.Testing
uv run pytest tests— 897 passed, 6 skippeduv run pytest tests/test_render_controls.py tests/test_render_navigation.py --run-nightly— 169 passed, including all three originally-red readings and the newdemo-playbackarchetypeuv run pytest tests/test_site.py tests/test_render_export.py --run-nightly— 68 passed (the standalone-export check is what pins the status'soffermarker)pre-commiton the changed filesscripts/preview.py feature-galleryin a real browser at 1280px: the row reads the same, and the reserved widths holdReplayin place across the whole demonstrationOne unrelated red reading, seen locally and not from this diff
test_render_options.py::test_a_selected_question_keeps_one_action_context_while_tab_reaches_its_fieldfails on this runner withthe key line covers the add field by ~1.5px. It fails the same way on a cleanmaincheckout here (three runs out of four), and it passed in the nightly run this PR is fixing, so it is environmental to this container rather than anything in this change. Not addressed here.Automated fix for failed run