Skip to content

Keep the root's bar standing rather than reserving a gutter it never draws in - #121

Merged
max-sixty merged 2 commits into
mainfrom
fix/ci-33296140347
Aug 30, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/ci-33296140347

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

ci has been red on main since 26feec8b "Use the browser root as Leaf's document scroller" — four consecutive runs, the same 13 tests each time, the run this was dispatched for included (its commit only edited TODO.md). The root scroller took scrollbar-gutter: stable, and Chromium honours that by holding a classic bar's width open even where the platform draws overlay bars, which take no room at all. That width comes out of the page while every window-relative coordinate keeps the whole window, so the layout and everything that measures against the window disagree by exactly one bar.

Measured here, at a 1200px viewport: the html box is 1185px wide, documentElement.clientWidth is 1200, and innerWidth - documentElement.clientWidth — the reading the suite and stateStrip use to find the bar — is 0. The 15px is reserved and nothing reports it. The three shapes the suite caught: a drawn edge landed a bar's width off the hand that drew it (the edge did not follow the hand: … 'edge': 590 … 'chosen': '595'), a covering sheet anchored to the initial containing block's right edge left a blank strip at the window's ('panel': {'left': -15, … 'right': 305} on a 320px window, with the toast inside it off screen), and a page with nothing overflowing measured a bar's width narrower than the box it scrolled in (assert -15 == 0).

The browser behaviour, isolated

Standards mode, this suite's pinned Chromium (151.0.7922.34), 1200×800:

html rule innerWidth de.clientWidth de.scrollWidth de.getBoundingClientRect().width
overflow-x: hidden; overflow-y: auto 1200 1200 1200 1200
overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable 1200 1200 1185 1185
overflow-x: hidden; overflow-y: scroll 1200 1200 1200 1200

The bars here are overlay ones — a nested overflow: auto container with vertical content keeps clientWidth === offsetWidth, and the same container with scrollbar-gutter: stable loses 15px. So the gutter is reserved for a bar that will never stand in it, and scrollWidth - clientWidth — the suite's "does the page scroll sideways" reading — sits at -15 before anything overflows.

Solution

overflow-y: scroll asks for the same standing bar that the stable gutter was there to get. It is a no-op where bars overlay, and where they take room it takes exactly the room the bar does — the room innerWidth - documentElement.clientWidth already reports, which is what #64 and #65 established as the one reading. It also makes true again the sentence skills/leaf/CLAUDE.md states about the new scroller, that documentElement.clientWidth is already the root scrollport's usable width; that comment in chrome-layout.js is reworded to say the standing bar rather than the reserved gutter.

Two tests carried a stale premise from before the scroller moved, and neither is loosened here:

  • the render gate's off-window float is still required to be named, against <html> — the scrollport since the move — rather than <body>. The gate already reports it that way; the same stale sentence in render-checks/layout.js is corrected beside it.
  • test_covering_panel_takes_the_page_scroll_with_it now waits for the glide that centres a quoted passage to be over before it wheels. The glide reaches its destination a frame or more before the browser fires its scrollend, and a wheel sent inside that window cancels the animation instead of scrolling, so the reader's notch is spent stopping a glide that had already stopped moving. Measured: at the moment the mark is centred one scrollend has fired, at 3442 — the instant scroll's — and the glide's own lands at 3669 afterwards.

Testing

All 14 tests the failed run reported now pass, and each was reproduced first at -n0 on main at 01ec4f4. Also green: the everyday suite (uv run pytest tests, 723 passed), and test_render_controls.py, test_render_pages.py, test_render_widgets.py, test_render_gate.py, test_render_options.py, test_render_margin.py, test_render_navigation.py with --run-nightly (362 tests). ruff check, ruff format --check, prettier --check, and node --check pass on the touched files.

One failure in that run this does not fix

test_render_gate.py::test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive is intermittent and predates this branch: on main with these changes stashed it failed 2 runs in 6, and with them applied 1 in 3 — the same rate, and the arrangement it names differs every time (the leaves tray standing here, the tray panel at the width the reader drew it to and the thread panel open in the two CI runs).

What it is, for whoever picks it up

The extra motion is CSSTransition box-shadow 120ms on 57–83 lf-options, and it is not hover — document.querySelectorAll(':hover') is empty when the finding lands. theme.css's arrival guard is body:not([data-lf-presented]) and .lf-ui, and its own comment names the trade: "transition does not inherit, so what an unreached descendant can still play is a transition of its own declaring; that is the trade, and the check that finds one is the suite's". lf-options[choose] … > lf-option in the default package theme declares transition: box-shadow .12s ease, transform .12s ease, and its box-shadow is var(--lf-ring), var(--lf-lift) where --lf-ring moves when replay writes [chosen]. So it is an unreached descendant with a transition of its own, and the coverage that was supposed to find one has. Left out of this PR because it is a separate cause in a separate layer and would be revertable on its own.


Automated fix for failed run

Rebased onto d8d1f1e

main has since absorbed three of the five files this branch touched, so the diff is now the chrome-style.js rule and the scrollend wait alone. 7336a14 landed the render gate's <root scrollport> naming and its own wording of the layout.js comment, and 335bf9a deleted the chrome-layout.js sentence reworded above. Everything the Solution section says about those three files is now true of main rather than of this diff; the CSS change and its reasoning are unchanged.

The Testing section describes the tree as it stood at 01ec4f4. Re-measured on d8d1f1e, over the 57 tests the latest red run (33325826683) reported plus 7336a14's new test_the_render_gate_measures_sideways_room_at_the_root_scrollport: 28 red before this branch, 20 after. The nine it fixes include that new gate test, which asserts on a non-overflowing page exactly the -15 this PR is about. Two of the twenty it leaves red are reached only because it gets past an earlier assertion, and neither is its doing — the thread comment below carries them.

What the covering lock costs

The two covering locks spell themselves overflow-y: hidden, which draws no bar, while scrollbar-gutter: stable held its room open under hidden too. So where the platform draws classic bars, the strip of page still visible beside a covering sheet now widens by a bar's width as the sheet opens and narrows back as it closes — one more rewrap on a window that was already rewrapping. Holding that room across the lock means reserving it on every platform, overlay-bar ones included, which is the 485 box inside a 500 clientWidth this PR exists to end, and the locked state is where it cost the most: that is the covering sheet landing at left: -15 with its toast off screen. So the rewrap stays, and it is recorded beside the lock rules rather than only in the thread. No test can see it — every browser the suite launches carries --hide-scrollbars.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33295912178 (8e1db37 "Upgrade mermaid to 11.17.2"), which is one of the four consecutive runs this PR names — 12 of the tests it lists, at the same numbers. I reproduced each at -n0 on 01ec4f4 and reached the same diagnosis independently, so this is a second confirmation rather than a second fix; nothing further from me.

One measurement worth adding, because it names a fourth window-relative coordinate and it is why the toast case here is a fix rather than a coincidence. vw turns on the very declaration this PR changes: viewport-percentage units are resolved against a viewport whose scrollbars are assumed not to exist when the root's overflow is auto, and to exist when it is scroll. So under auto plus the stable gutter, 100vw stayed the whole window while the box it was spent in was a bar narrower — that is what put .lf-toast (held to one edge by right: 18px, sized off the other by max-width: calc(100vw - 36px)) 3px from the far edge instead of 18. Under overflow-y: scroll it resolves to the scrollport, and the box lands where it was aimed with no rule rewritten.

The same measurement says that displacement was the hidden-bar browser's alone: with real bars, clientWidth, the root's box and vw already agreed under both spellings, so neither a reader nor this machine's suite could have seen it.

Measured: .lf-toast at a 320px window, panel shut

Same page and the same pinned Chromium, launched twice — once as the suite does, once with ignore_default_args=["--hide-scrollbars"].

root rule bars innerWidth de.clientWidth root box toast left → right
auto + scrollbar-gutter: stable (main) hidden 320 320 305 3 → 287
auto + scrollbar-gutter: stable (main) real 320 305 305 18 → 287
overflow-y: scroll (this PR) hidden 320 320 320 18 → 302
overflow-y: scroll (this PR) real 320 305 305 18 → 287

Row 1 is the only one where vw and the box disagree: 100vw - 36px is 284px inside a 305px box, which outruns the 287px the right inset leaves, and the overrun comes off the far end. In every other row vw is the box and the same expression fits where it was meant to.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33297154334 (6d71b628 "Unify external-data document boundaries") — the same 13 tests, at the same numbers, plus the intermittent one this PR leaves open. Nothing to add to the fix; independently reached the same reading of the gutter (html box 1185 against documentElement.clientWidth 1200 at a 1200px viewport), and overflow-y: scroll keeps the standing bar that dropping the declaration outright would have given up.

One datum for the failure this PR sets aside: test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive predates the scroller commit, not just this branch. Checking skills/leaf and tests out at d226ee2 — the last commit whose ci run was green — and running it at -n0 five times gave 5 failures out of 5, against 2 in 5 at 01ec4f4. So the green run at d226ee2 was luck rather than a working state to bisect back to, and the extra motion it names is not something the root scroller introduced.

Method

git checkout d226ee2 -- skills/leaf tests, five runs of uv run pytest tests/test_render_gate.py -q -n0 --run-nightly -k arrives_at_what_they_left, then git checkout HEAD -- skills/leaf tests. leaf is installed editable from the checkout, so the assets under test are the ones checked out. The arrangement named differed run to run there too (the leaves tray standing, the decisions tray standing, design mode on).

Instrumenting transitionrun puts the change inside the arrival window rather than at replay: the transition starts at 92–126ms, on every lf-option in the group at once, with --lf-ring already at 0 0 #0000 and unchanged, and --lf-joined at 1 throughout — so on this page it is the shadow arriving at all, not [chosen] moving it.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33295489155 (26feec8b, the first red run) — the same 13, and this PR's fix reproduces here too: with overflow-y: scroll in place of the gutter, 12 of them pass and the render gate's off-window float is named against <html>.

The one left open now has a fix in #122, based on main rather than on this branch. Building on the transitionrun reading already in the thread: the keyframes are boxShadow: "none" → the two transparent channels, and theme.css's own startTime-responseEnd (86–135ms for the composed 230KB sheet) brackets the transition's start at 105–155ms. The sheet is render-blocking but not style-blocking, so a recalc landing inside its fetch styles the options with box-shadow's initial none first; the sheet then states the value and the ease it granted two rules below plays. Whether a recalc falls in that window is the intermittency. #122 withholds the transition behind the presentation stamp, spelled as theme.css's arrival guard is, and takes that test to 15 green runs out of 15.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33296070275 (3d494e1) — the same 13 plus the arrival test, same numbers, same independent reading of the gutter as the three notes above. Nothing to add to the fix.

The one thing not yet in this thread is the run these two branches have to survive: ci runs the complete nightly suite, and neither PR's testing section does. On main at 6d71b62 with both fixes in one tree, uv run pytest tests --run-nightly came back 1519 passed, 3 failed, 6 skipped in 42:18. None of the 14 is among the three, so the pair looks sufficient for a green ci — and it takes both, #122 being based on main rather than on this branch.

The three, and why they read as contention rather than as a finding
  • test_render_drafts.py::test_a_stale_cancel_cannot_settle_a_newer_durable_generation — Locator expected to have Value 'The newer edit now owned by shared storage.'
  • test_render_navigation.py::test_a_label_press_keeps_the_controls_keyboard_standing — assert 'unselect' in 's\nselect item\nesc\nlet go\n?\nmore'
  • test_render_startup.py::test_a_fast_first_replay_does_not_flash_the_waiting_surface — reload painted Leaf's waiting surface

Three unrelated tests, each failing on a wait none of them owns, in a run driven at -n 4 on a 4-core sandbox — double the workers pyproject.toml configures and CI uses. All three pass at -n0, and test_render_startup.py whole plus the other two pass three consecutive times at -n2. That is running-tend's contention shape; it says nothing about either branch, and it is not a claim that these three are clean in general.

The tree was this session's own edits rather than a checkout of the two branches — the same four changes in different words, with the covering-panel wheel waiting a rendering turn (page.evaluate(RENDERED)) instead of for the glide's scrollend. Measured here the wheel is dead at zero turns and lands at one, which agrees with this branch's reading of what that wait is for.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33296628104 (1dd6976, "Share the render gate's margin reading") — the same 13, and an independent pass over it reached this PR's three findings and no others. Adding only the one measurement that refines a sentence above: the wheel this PR now waits for scrollend before sending is not cancelling a glide that is still running. The glide has already made its last write when the mark centres, so nothing is left to cancel — the notch is simply never applied.

What the frames say

Sampling document.scrollingElement.scrollTop and the mark's offset from the viewport's middle every requestAnimationFrame from the quote press, at 500×600 on LONG_PAGE with anchored=[("p40", …)]:

t=52  top=3442  markDelta=226.95   ← the instant scroll; its scrollend fires here
t=286 top=3667  markDelta=1.95
t=302 top=3669  markDelta=-0.05    ← the glide's last write; `glide` clears itself
t=350 -------------------------    ← the travel's own scrollend

So the centring predicate first holds on the glide's final frame, not part-way through the ease. A wheel sent there produced no movement at all — 60 rAF samples over the next second all read 3669, with no intermediate value to suggest a write that was undone — and its wheel event arrived at the page with defaultPrevented: false.

The same wheel lands from ~20ms after that final write onward, which is before the travel's scrollend at 48ms, so this PR's wait is sufficient rather than minimal. It also lands immediately if a repaint is forced first (toggling document.body.style.outline across four frames), which points at the browser's side of the transition rather than the runtime's.

Verified on the same tree with the fix expressed the other way — deleting scrollbar-gutter: stable outright rather than asking for overflow-y: scroll — so the readings above are about the wheel, not about which of the two spellings the root carries.

max-sixty pushed a commit that referenced this pull request Aug 30, 2026
…#127)

## Problem


[335bf9a](335bf9a)
"Delegate page chrome to browser standards" took `ci` on `main` from 13
failures to 60 ([run
33317065355](https://github.com/max-sixty/leaf/actions/runs/33317065355)).
The 13 are the standing scrollbar-gutter set that #121 already covers —
I confirmed them against [the run on
01ec4f4](https://github.com/max-sixty/leaf/actions/runs/33297425217),
the commit before this one. The other 47 are new, and they come from two
moves in that commit, each of which leaves a reading that fails silently
rather than loudly.

`offer` now builds native elements, so a `[role=button]` selector
matches nothing where it used to match every control a widget injected.
`--lf-room` and the margin strips moved from numbers the runtime wrote
to expressions CSS resolves, so
`parseFloat(getComputedStyle(el).getPropertyValue('--lf-room'))` is
`NaN` and every comparison against it is false — a check that stops
checking without ever failing.

## Solution

Six readings, each corrected where it is asked:

- **`lf-suggestion` finds its own controls.** `:scope > [role='button']`
matched neither of the two native buttons, so a decision never
relabelled them, never reserved room for the longer word, and the margin
item had nothing to focus. Asked through `[data-lf-offer='button']`,
which is what `offer` and `selectableOffer` both write whatever element
they pick.
- **`DECISION_CONTROL` is one `:is()` compound.** `standOn` prefixes it
with a descendant selector, and a prefix binds only to the *first*
alternative of a selector list — so `[data-lf-for="…"]
button[data-lf-offer], [data-lf-offer][tabindex]` read as "a control in
this decision's row, or any offered tab stop anywhere", and the ask walk
landed on the first control on the page instead of the decision it was
sent to.
- **The margin preview suppresses its entry on `beforetoggle`.** A
platform dismissal returns focus to the marker while the hide is still
running; the marker's focus listener re-showed the card from inside that
operation, which throws `InvalidStateError: Invalid to show a popover
during another show operation` on every Escape.
- **Both `--claim-map` grants hold their condition in `:where()`.**
Dropping `:not([data-lf-cramped])` from the wide card grant took its
specificity below the narrow rail grant's, so a page whose thread needed
the 384px card kept the 57px rail. Equal specificity puts document order
back in charge, which is what the two rules' arrangement already
assumed.
- **The render gate's `withheldRoom` measures room with a probe.** It
had gone quiet: `NaN > 0` is false, so a drawing held under its own
graph beside an empty margin was named nowhere.
- **`bake` removes controls by a *valued* offer marker.** Widened from
`[data-lf-offer][tabindex]` to the bare attribute, it also matched the
boxes a widget builds to hold its controls, and removed a suggestion's
✓/✗ row outright — taking the "✓ Accepted" a decided change speaks
through out of the copy with it, and leaving the rail the copy still
reserves with nothing in it.

Tests read the same two facts the same way: a probe for `--strip-r` and
`--lf-room`, `[data-lf-offer=button]` for a control whose element the
layer now chooses, and `button lf-sug-accept` where a walk asserts the
tag it lands on. No assertion is loosened — each one still asks what it
asked.

## Testing

Everyday suite green (`uv run pytest tests`, 723 passed, 6 skipped). Of
the 47 regressions this commit introduced, **27 now pass** and one has
since been renamed away by 07373f4; each was reproduced first at `-n0`
on `main`. `test_render_margin.py`, `test_render_export.py`,
`test_render_projection.py`, `test_render_pages.py` (bar the two
standing gutter failures) and `test_render_options.py` are green with
`--run-nightly`. `ruff check`, `ruff format --check`, `prettier --check`
and `node --check` pass on the touched files (CSS is prettier-excluded
here by `.pre-commit-config.yaml`).

## What this does not fix

Nineteen of the new failures remain, in four groups I could diagnose but
not fix without deciding something that looks like yours to decide.
Recorded here so the next session starts from the diagnosis rather than
from the symptom.

<details><summary>The four remaining groups</summary>

**The generic CONTROL contract went with the old `offer`** —
`test_example_renders[gallery]`, `test_example_renders[command-hub]`,
`test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it`,
`test_the_arrows_say_which_way_the_section_under_the_reader_goes`. The
render gate reports 16 findings of the shape `<lf-command id=hub-plan>
says "3 running" inside a form control, where no selection can reach
it`: `lf-command`'s `speakingOffer` and `lf-worktree`'s head build a
native `<button>` and then `relabel(…, {says: true})` it, which is
exactly the case `selectableOffer` exists for. Moving them back is not
mechanical — the shared CONTROL key scope went with the old `offer`, so
a span has no Enter/Space until its widget declares them, the way
`lf-tabs` and `lf-options` now do. The same scope is why the key line
stopped naming `press it` and `⏎ / space` over a widget's control: those
keys are the platform's now and nothing declares them, so the line has
nothing to say about a press that still works.

**Escape belongs to whichever layer the browser is holding** —
`test_the_version_menu_is_worked_by_pointer_and_key`,
`test_the_versions_menu_suspends_the_pages_own_keys`,
`test_the_menu_a_first_version_opens_is_a_menu_it_can_close`,
`test_a_row_the_platform_activates_names_both_of_its_keys`,
`test_esc_hands_the_page_back_after_it_has_closed_the_last_panel`. The
versions menu is now `popover=auto`, so the platform light-dismisses it
on Escape — including the Escape that was meant for the help overlay
standing over it. The `VERSIONS` mode still suspends the page's keys but
no longer owns its own way out, and the key line stopped naming one
(`close versions`). Which layer answers Escape when two are up is a
product decision.

**The panel as a `<dialog>`** —
`test_covering_panel_takes_the_page_scroll_with_it`,
`test_workspaces_replace_each_other_instead_of_stacking[500]`,
`test_coarse_pointer_chrome_gives_its_compact_controls_humane_aims`,
`test_selection_hints_do_not_name_page_content_behind_a_covering_panel`,
`test_a_mark_in_the_layer_promises_no_press_the_layer_will_not_take`.
Measured on a 320×600 window with the panel covering:
`documentElement.clientWidth` is 320 while the fixed containing block is
305, because `overflow-y: hidden` stops the gutter coming out of
`clientWidth` without stopping it coming out of the layout.
`drawn-edge.js`'s `cap()` reads the first, so the panel is drawn a bar's
width wider than the room it is placed in and hangs at `left: -15`. That
is the same disagreement #121 is about, reached by a second route, so it
may want to land on top of that branch rather than beside it.

**The margin rows' own layout** —
`test_suggestion_controls_stay_out_of_the_column`,
`test_suggestions_sharing_a_block_keep_source_and_keyboard_order`,
`test_a_float_the_panel_displaces_hands_the_page_no_sideways_scroll`,
`test_a_settlement_in_a_reply_leaves_its_own_anchor_on_the_page`,
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`.
The rows stay docked when the panel opens where they used to move out to
the rail. Separately, `showPopover({source})` gives the margin preview
an invoker relationship, so Tab from a marker now enters the card rather
than continuing down the page — three extra stops between one
suggestion's controls and the next.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33317065355)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
## Problem


`tests/test_render_gate.py::test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive`
is one of the thirteen failures in [the run this was dispatched
for](https://github.com/max-sixty/leaf/actions/runs/33295489155), and
the one #121 leaves out. It is intermittent and it predates the scroller
commit: measured at
[d226ee2](d226ee2a),
26feec8's parent, it failed 3 runs in 18 at `-n0`; at `main` `1dd6976`
it failed 5 in 17.

The extra motion is `CSSTransition box-shadow 120ms` on the page's
`lf-option`s, and it is not replay writing `[chosen]` — the keyframes
are `boxShadow: "none"` → `"rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0,
0, 0) 0px 0px 0px 0px"`. Both channels are transparent, so the
transition eases from nothing to nothing and no pixel differs at either
end. It fires at ~105–155ms, before `data-lf-upgraded` and long before
`data-lf-presented`, on whichever arrangement's load happens to hit it.

The cause is the stylesheet's own arrival. `theme.css` is
render-blocking but not style-blocking, so on a load where a style
recalc falls inside its fetch (measured at 86–135ms for the composed
230KB sheet) the parser has already styled the options with box-shadow's
initial `none`. The sheet then lands and states `box-shadow:
var(--lf-ring), var(--lf-lift)` in the same breath as the `transition:
box-shadow .12s ease` two rules below it, and the value change plays.
Whether a recalc falls in that window is what makes the failure
intermittent, and it is why the arrangement named in the message differs
every time.

## Solution

Withhold the transition until the page says it is presented.
`theme.css`'s arrival guard already says "arriving is not a gesture" for
`body` and for `.lf-ui`, and its own comment names this as the trade it
leaves to the suite — "`transition` does not inherit, so what an
unreached descendant can still play is a transition of its own
declaring; that is the trade, and the check that finds one is the
suite's". This is the finding, answered in the package that declares the
transition rather than by widening the layer's guard into the universal
selector that comment measured and rejected.

Spelled as that guard is —
`html:has(script[type="module"][src="/leaf.js"])
body:not([data-lf-presented])` — so a page with no runtime behind it,
which never stamps and never held its options back, keeps the ease it
always had. A copy has no script link and is out by the same clause.
Nothing visible changes: the suppressed transition ran between two
transparent shadows, and it ran while `main` was still `visibility:
hidden` behind the presentation gate.

## Testing

The named test, 15 consecutive runs at `-n0`: all green, against 3-in-18
at the commit before the scroller moved and 5-in-17 at `main`.

`uv run pytest tests` — 721 passed, 6 skipped. `test_render_options.py`,
`test_render_gate.py`, `test_render_widgets.py`, `test_render_pages.py`,
`test_render_margin.py` with `--run-nightly` — 237 passed, and the only
failures are the seven gutter findings #121 fixes, unchanged in shape.
`pre-commit run --files skills/leaf/packages/default/theme.css` passes.

<details><summary>How the diagnosis was taken</summary>

A `transitionrun` listener installed through `page.add_init_script`
before each arrival, recording `performance.now()`, the readiness
stamps, the computed `--lf-ring`/`--lf-lift`, and
`getAnimations()[0].effect.getKeyframes()`:

```
{'t': 117, 'tag': 'lf-option', 'id': 'wait-day', 'prop': 'box-shadow',
 'presented': False, 'upgraded': False,
 'shadow': 'rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px',
 'ring': '0 0 #0000', 'lift': '0 0 #0000', 'joined': '1',
 'settled': False, 'chosen': False,
 'ready': 'interactive', 'sheets': 1, 'theme': '16-86', 'nav': '4/0'}
```

`theme` is theme.css's `startTime`-`responseEnd`, `nav` the navigation's
`responseEnd`/`domContentLoadedEventStart`: the HTML was complete at 4ms
and the sheet landed at 86ms, with the transition starting at 117ms. On
the runs where the test passes no such entry exists at all.

Hoisting the two shadow channels onto `lf-option` itself, so the `:has(>
lf-option > strong)` card rule could not be what flips the value
mid-parse, was tried first and changed nothing — the keyframes still
started at `none`, which is what pointed at the sheet rather than at a
selector inside it.

</details>

---

Independent of #121 and based on `main`, not on its branch: a separate
cause in a separate layer, revertable on its own. Together the two take
the failed run to green.

Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33295489155)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
## Problem

[Run
33320898593](https://github.com/max-sixty/leaf/actions/runs/33320898593)
failed with 68 tests red on 07373f4. Sixty of those were already red on
the commit before it and are what #127 is about; thirteen were new, and
eleven of those have since been fixed or renamed away by #125, #126, or
#127's branch — I ran each of the thirteen at `main` and on #127's
branch to sort them. What is left, failing on `main` and on #127's
branch alike, is `test_the_chrome_a_key_opens_has_no_serious_violations`
at both `[420-light]` and `[420-dark]`: axe reports a serious
`target-size` violation on the panel's page-reaction trigger, standing
on the comment list.

The trigger is 29.5×21.5px, which passes `target-size` on spacing alone
— until something else to press moves next to it. Over a covering panel
the key line and the toast are lifted above the sheet's foot, and [that
lift was measured off the general composer's
height](https://github.com/max-sixty/leaf/blob/6794ddcc1286aa1d776060417aaf5dd145524da6/skills/leaf/assets/runtime/chrome-layout.js#L132-L135).
Once a page offers reactions the foot is two rows, not one:
`paintPageStrip` inserts the page's own reaction strip above the
composer, and the line was drawn straight over it. Measured at 420×900
with the panel covering, the line spanned y 767.7–827 and the strip's
trigger y 811.2–832.7. 07373f4 then widened the line to two rows, which
brought its `? more` button — the one part of the line that takes a
pointer — down to x 25–88.7, on top of the trigger at x 14–43.5. axe
measured 8.8px of safe clickable space between them. A reader aiming at
the reaction got the keyboard reference.

## Solution

The panel gets one foot box holding the strip and the composer, and the
lift is measured off that box. The strip is as fixed as the composer is,
so a lift that clears one has to clear both; the `ResizeObserver`
watches the foot too, so the strip appearing is the same kind of event
as the composer growing under a draft.

Lifting further puts the line back over the panel's scrolling thread
list, which is the third scroll region the line can stand over and the
only one that was not reserving room for it — the document reserves it
on `chromeRoot`, the trays' lists through `reserveListClearance`. The
list now spends the same measurement the same two ways (padding for a
wheel to the end, scroll-padding for a walk's scroll-into-view) while
the panel covers, and returns to the stylesheet's inset when the panel
steps back beside the page and the line is capped clear of it.

Same page and window after the change: foot 797.2–900, line 723.7–783,
trigger untouched at 811.2–832.7, list reserving 79px at its end.

## Testing

`test_a_covering_sheet_lifts_the_key_line_over_all_of_its_foot` is new.
It asserts the foot is genuinely taller than its composer first, so a
page with no strip cannot green it, then that the line clears the foot
and the trigger, that the list reserves at least as much of its own end
as the line stands on, and that the reservation is returned beside a
wide panel. Reverting either half of the fix in turn fails it on the
matching assertion.

<details><summary>Runs</summary>

- `uv run pytest tests` — 723 passed, 6 skipped.
- `uv run pytest --run-nightly tests/test_render_controls.py` — the two
`[420-*]` cases now pass. Nine failures remain; the same nine fail on
`main` in the same file, and all nine are in run 33320898593's list.
- `uv run pytest --run-nightly` over `test_render_conversations.py`,
`test_render_navigation.py`, `test_render_margin.py`,
`test_render_pages.py`, `test_render_outbox.py`, `test_render_gate.py` —
20 failures, every one of them already in run 33320898593's list. No new
failure in any file.
- `pre-commit` on the four touched files: trailing-whitespace,
end-of-file-fixer, mixed-line-ending, ruff check, ruff format, prettier,
eslint, typos all pass.

`test_dynamic_chrome_offsets_keep_the_safe_area_in_their_arithmetic`
measured its expected key-line and toast bottoms from `.lf-general`,
which is now the wrong box wherever a strip stands; it reads
`.lf-panel-foot`. It is red on `main` for an unrelated reason — the
panel is drawn at `left: -15` on a window with a scrollbar gutter, which
is #121's subject — and stays red here.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33320898593)

Co-authored-by: leaf-agent <[email protected]>
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Two things have changed since the five notes above, so this is not another "same 13".

The branch no longer applies. git cherry-pick 01987e8 onto d7f9d0f conflicts in chrome-layout.js: 335bf9a rewrote the region this branch edits into syncPanelLayer, and the comment reworded here about the root's standing bar has moved. The other four files still apply clean. It needs a rebase before it can land.

The fix still holds, at a smaller count. Applying only the chrome-style.js hunk (overflow-y: scroll for scrollbar-gutter: stable) to d7f9d0f takes today's failing set from 31 down to 23 — the_reader_draws_an_edge_to_the_width_they_want, a_window_with_no_room_for_a_chosen_width_does_not_un_choose_it, opposite_margin_residents_wait_for_the_room_they_need, the_asks_tray_takes_room_rather_than_covering_the_column and a_specimen_holds_a_wide_exhibit_inside_the_column among them. It is fewer than 13 because intervening commits fixed some of the rest on their own, not because the reading weakened.

Raised from ci-fix on run 33326754065; #133 has that run's full ownership map.

…draws in

The root scroller took `scrollbar-gutter: stable`, and Chromium honours that by
holding a classic bar's width open even where the platform draws overlay bars,
which take no room. The width came out of the page while every window-relative
coordinate kept the whole window — pointer positions, `innerWidth`, and the
root's own `clientWidth` — so a drawn edge landed 15px off the hand that drew it,
a covering sheet anchored to the initial containing block left a blank strip at
the window's right, and a page with nothing overflowing measured 15px narrower
than the box it scrolled in.

`overflow-y: scroll` asks for the same standing bar without reserving room the
platform will not use: a no-op where bars overlay, and exactly the bar's room
where they take room, which is the room `innerWidth - documentElement.clientWidth`
already reports.

The render gate now names the root rather than body as the container an
off-window float went out of, that being the scrollport since the move. The
covering-panel journey waits for the glide that centres a quoted passage to be
over before it wheels: the glide reaches its destination a frame before the
browser calls it done, and a wheel sent inside that window cancels the animation
instead of scrolling.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33325826683 (686efad). Rather than a seventh "same set", this rebases the branch and measures what it is now worth against a main that has moved 25 commits since it was written.

Rebased onto d8d1f1e and pushed (01987e8 → 0812458). Three of the five files were conflicts that main has since resolved on its own terms, so they drop out: 7336a14 landed the render gate's <root scrollport> naming and its own version of the layout.js comment, and 335bf9a deleted the chrome-layout.js sentence this branch reworded. What is left is the chrome-style.js rule and the scrollend wait, unchanged.

It is worth more than when it was written, not less. On d8d1f1e, 28 tests are red: 27 of the 57 from the dispatching run (the other 30 have been fixed since), plus test_the_render_gate_measures_sideways_room_at_the_root_scrollport, which 7336a14 added after this PR and which asserts document.scrollingElement.scrollWidth - clientWidth == 0 on a page with nothing overflowing. That is this PR's assert -15 == 0 written a second time, independently, by the commit that moved the reading to the canonical scroller. With the rebase applied, 20 are red — 9 fixed, that new gate test among them.

The gutter also loses real overflow, which this thread has not recorded yet. Every finding above is a false failure; the same 15px runs the other way through rootOverflow, which reports only overflow > 0. Measured on a bare standards-mode page at 1200×800 with html { overflow-y: auto; scrollbar-gutter: stable }:

page scrollWidth clientWidth getBoundingClientRect().width reported spill
fits 1185 1200 1185 none (−15)
spills 8px past the port 1193 1200 1185 none (−7)
spills 40px past the port 1225 1200 1185 25

So the gate is blind to any sideways spill under a bar's width and short by one on every wider spill — on the platforms where a reader's window is narrowest and the spill matters most. overflow-y: scroll closes that because it puts the three readings back in agreement rather than correcting any one of them.

The two of the remaining 20 that touch this PR's own tests, and why they are not its doing

Both were reached only because this fix gets past an earlier assertion; each was verified to fail with the CSS change reverted and the reading correct.

  • test_render_pages.py::test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back — added by 6a50d50, an hour after this PR. It drives 1400 and comes back to 1200, and the retained rail claim leaves the column 950 - 264 = 686 rather than 720. Not the gutter: with this fix the port is the whole 1200px window and it still reads 686. Measured on this runner, after the 1400px visit, the column only returns to 720 from a 1235px port upward — 264 (left strip) + 720 (column) + ~250 (retained rail) needs more room than 1200 has, so something has to give and it is the column rather than a strip. Font metrics decide the rail's width, which is the likeliest reason it holds on a Mac.
  • test_render_controls.py::test_the_responsive_action_shelf_keeps_primary_actions_in_reach — clears its sideways assertion, then times out on .lf-threads-toggle with <dialog open class="lf-ui lf-panel open"> intercepting the click.

test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus also appears in the 20, but passes at -n0 on this branch and was green on the d8d1f1e baseline in the same shape of run, so it reads as load rather than as a regression here.

How the two runs were measured

Both are the same 58 node ids (test_example_renders[gallery] dropped — that example no longer exists), --run-nightly -n2, on this runner, back to back:

  • d8d1f1e: 28 failed, 30 passed
  • 0812458 (this branch rebased): 20 failed, 38 passed

Fixed by the rebase: test_the_render_gate_measures_sideways_room_at_the_root_scrollport, test_a_wide_banner_spends_status_copy_before_action_reach, test_covering_panel_keeps_toasts_on_screen_and_clear_of_the_footer, test_dynamic_chrome_offsets_keep_the_safe_area_in_their_arithmetic, test_a_window_with_no_room_for_a_chosen_width_does_not_un_choose_it[comments], test_the_reader_draws_an_edge_to_the_width_they_want[comments], test_a_specimen_holds_a_wide_exhibit_inside_the_column, test_opposite_margin_residents_wait_for_the_room_they_need, test_the_asks_tray_takes_room_rather_than_covering_the_column.

ruff check, ruff format --check, prettier --check, and node --check pass on the rebased tree.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reverted the declaration on this tree and confirmed the reading independently: test_the_render_gate_measures_sideways_room_at_the_root_scrollport reproduces AssertionError: {'body': 324, 'root': -15} under auto + scrollbar-gutter: stable, and passes under overflow-y: scroll. test_covering_panel_takes_the_page_scroll_with_it passes at -n0 with the new scrollend wait, and the wait is the shape tests/CLAUDE.md already prescribes for this ("wait for the mark to reach the computed position or for the final scroll to stop").

One consequence of the swap the thread has not recorded, inline: the two covering locks override this declaration with overflow-y: hidden, which the old spelling survived and the new one does not.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The first of the two tests in the collapsed block above now has a fix: #136 confirms the reading (the rail claims 250px on this runner against the ≤216px a stated 1200px window needs) and derives the narrow window from --strip-l + 720 + --strip-r instead of stating it — 1234px here, which is the "1235px port upward" measured above. Applying only this branch to 26dbf42 leaves that test failing at assert (950 - 264) == 720; applying only #136 leaves it failing at the centring assertion this branch fixes. The two together turn it green, so merging this one alone still leaves it red on the next push to main.

The lock spells itself overflow-y: hidden, which draws no bar, while the reserved gutter it replaced held its room open under hidden too. Where the platform draws classic bars the visible strip beside a covering sheet now rewraps by a bar's width as the sheet opens. Recorded beside the lock rules, with why holding the room across it would reinstate the disagreement the root's own rule ends.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Two more tests now depend on this branch, and both arrived after every note above: 0d7e0d0 "Open threads beside their source" landed the contextual-thread margin, and its own two posture tests are red on main for the gutter this branch removes.

test_the_full_thread_posture_follows_the_page_container_and_left_claims and test_the_shipped_long_thread_opens_beside_its_source_in_the_right_margin both turn on @container lf-shell (min-width: 1472px), and lf-shell is body. Measured on main at a 1472px window with the sidebar page that test uses: innerWidth 1472, documentElement.clientWidth 1472, body's box 1457 — the reserved gutter, fifteen pixels short of the floor the rule names, so --lf-thread-beside stays 0 and the card never takes the margin. It is the same disagreement this PR is about, reached by the newest route: the feature states its threshold against the window and the container answers with the window minus a bar nothing draws.

Measured three ways on this runner, test_render_margin.py with --run-nightly:

tree result
main at 1ca4f40 2 failed, 20 passed
#138's head merged with main 2 failed, 20 passed
this branch (37e5c16) merged with main 22 passed

So the two are this branch's, not #138's — and they are not a fourth "same 13" but a fresh cost, on a feature that is already on main.

How that was taken

The reading, from the sidebar arrangement in test_the_full_thread_posture_follows_the_page_container_and_left_claims — DECISION_PAGE with <aside class="sidebar">, resized to 1472×900, marker clicked:

{'inner': 1472, 'deClient': 1472, 'bodyBox': 1457,
 'mainClaim': 'calc(52px + calc(2px + 3px))', 'beside': '0'}

mainClaim is the 900px marker-strip grant rather than --thread-margin, which is what beside: 0 says: the 1472 rule did not match.

Each tree was git merge origin/main into the branch head, not a cherry-pick — both merged clean at 1ca4f40; the only conflict-prone file, chrome-layout.js, was already resolved by the rebase recorded above. test_render_margin.py was run whole, -n4, on the pinned headless shell.

Reverting only the declaration on main — overflow-y: scroll in place of overflow-y: auto; scrollbar-gutter: stable at chrome-style.js:27 — takes the same file to 22 passed on its own, so it is that line and nothing else on this branch.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33329901507 (26dbf42, "Add external link treatment"). Not another "same set" — the note above already measured main at 1ca4f40, and the two margin tests it names are the news. One test this branch turns is still named on no PR, issue or comment, so it is the whole of what I have to add.

test_render_controls.py::test_dynamic_chrome_offsets_keep_the_safe_area_in_their_arithmetic. It reads as a bare Page.wait_for_function timeout, which is why it has been sorting with the panel-as-dialog group rather than with the gutter. It is the gutter. LONG_PAGE at 500×700 with --lf-safe-right: 31px and the covering panel up: the toast's computed right is 49px — exactly the 18px + var(--lf-safe-right) chrome-layout.js writes, so the arithmetic the test is named for is correct — and its getBoundingClientRect().right is 436 where the test asks for innerWidth - 18 - 31 = 451. 500 - 436 = 64 = 49 + 15. The toast is position: fixed, so it resolves against the initial containing block that the stable gutter narrows, while innerWidth keeps the whole window: the covering-sheet case already in this PR's Problem section, reached by a fixed box that anchors to the right edge instead of filling it. It passes with this branch's one CSS hunk applied and fails without it.

The rest of that run's set, measured here

Run 33329901507 reported 34 failed. Re-running those 34 node ids on 1ca4f40 at -n0: 31 red. Three now pass — test_example_renders[command-hub] and test_the_composed_corpus_declares_every_control_row_archetype, which 726382c turned by landing #132's selectableOffer change on lf-command.js and lf-worktree.js, and test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus.

Applying only this branch's chrome-style.js hunk to 1ca4f40 takes those 31 to 22. The nine:

test_render_controls.py::test_a_wide_banner_spends_status_copy_before_action_reach
test_render_controls.py::test_covering_panel_keeps_toasts_on_screen_and_clear_of_the_footer
test_render_controls.py::test_dynamic_chrome_offsets_keep_the_safe_area_in_their_arithmetic
test_render_gate.py::test_a_window_with_no_room_for_a_chosen_width_does_not_un_choose_it[comments]
test_render_gate.py::test_the_reader_draws_an_edge_to_the_width_they_want[comments]
test_render_gate.py::test_the_render_gate_measures_sideways_room_at_the_root_scrollport
test_render_options.py::test_a_specimen_holds_a_wide_exhibit_inside_the_column
test_render_pages.py::test_opposite_margin_residents_wait_for_the_room_they_need
test_render_widgets.py::test_the_asks_tray_takes_room_rather_than_covering_the_column

test_covering_panel_takes_the_page_scroll_with_it is not among them because I applied the CSS hunk alone; this branch's scrollend wait is the half that turns it. Everything remaining in the 22 sits with #132, #134, #136, #137, #138, #140, #141, #143, or issues #133 and #139.

@max-sixty
max-sixty merged commit 5d2193e into main Aug 30, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/ci-33296140347 branch August 30, 2026 20:55
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
## Problem

`test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back` fails
on every `ci` run since 6a50d50 "Keep sidebar from narrowing centered
content", which added a second reading at a stated 1200px window:
`assert tighter["column"]["right"] - tighter["column"]["left"] == 720`,
reported as `assert (950 - 264) == 720`.

The page cannot hold a whole column at that width here. `--strip-l` is
the sidebar's 264px token, but `--strip-r` is `--rail`, which
[`margin-layout.js`](https://github.com/max-sixty/leaf/blob/e8c67bb31d2096900ce6c28a9c3083f7a3a2c40f/skills/leaf/assets/runtime/margin-layout.js#L94-L106)
sets by measuring the widest margin row and never lets shrink. That row
is a control — `✎ Edit` and `✓ Accept ✗ Reject?` — set in `--sans`, so
its width is the width the host's UI font sets those words in. A 1200px
window leaves 936px for the two residents and the column, so the
assertion holds only where the claim comes in at 216px or narrower.
Measured on the runner it is 250px: 264 + 720 + 250 = 1234 against 1200,
and the column gives up the 34px difference. `scripts/linux-suite.sh`
opens by naming this exact divergence — "what the two platforms disagree
about is exactly what a browser test measures: how wide a system font
sets a word, and whether a scrollbar takes a gutter out of the window".
Both halves of that sentence are in this test: the font is this change,
the gutter is #121.

The layout itself is doing what the commit describes:
`--lf-sidebar-edge` has already clamped to 0, so both outer gutters are
spent before the column narrows. Only the window the test states is
wrong.

## Solution

Derive that window from the claim instead of stating it. The test now
narrows to exactly `strip-l + 720 + strip-r` — the width at which the
sidebar, a whole column and the rail fill the page with no gutter left —
and asserts the column is still 720 there, with both residents on
screen. That is the invariant the block was written to prove ("the
sidebar and rail use the outer gutters before taking width from the
reading column"), and it holds on any font rather than on one machine's.
The window adds back whatever the root scrollport holds outside
`100cqi`, so the arithmetic is the container's either way.

The probe that already read `--strip-l` becomes a small `measure()` so
the same reading returns `--strip-r` and `100cqi` beside it.

## Testing

`uv run pytest tests/test_render_pages.py`, and the same file with
`--run-nightly`: **42 passed** each — but only with #121 also applied.
`pre-commit run --files tests/test_render_pages.py` passes.

**This alone does not turn the test green, and this branch's `ci` will
not say so either way.** `test_render_pages.py` is `pytestmark =
pytest.mark.nightly`, so it runs on the push to `main` and not in a pull
request's everyday suite — which is why #121's own `test` job is green
with the stated 1200px window still in its tree.

The other half is #121. The root's `scrollbar-gutter: stable` makes
`documentElement.scrollWidth` 15px narrower than its `clientWidth`, so
`assert roomy["sideways"] == 0` reads `-15`, and the centring assertion
above it compares a column centred in a 1385px container against a
1400px window. Applying only #121's `chrome-style.js` hunk to this
commit's parent leaves this test failing at `assert (950 - 264) == 720`;
applying only this commit leaves it failing at the centring. Both
together are what turns it green — verified in both directions on
26dbf42.

<details><summary>Measured, on 26dbf42</summary>

The reading at a 1400px window, unpatched `main`:

```
{'strip': 264, 'rail': 250, 'pageWidth': 1385, 'viewportWidth': 1400, 'sideways': -15,
 'column': {'left': 332.5, 'right': 1052.5}, 'marginCount': 7, 'marginRight': 1326.5}
```

The margin rows the claim is measured from, at that window: `✎ Edit` at
151px and `✓ Accept ✗ Reject?` at 199px, plus the row's left margin,
ceilinged — 250px. Narrowed to 1200 they condense to 103px and the claim
stays 250, which is the monotonicity the block's first sentence relies
on and this change keeps relying on.

With #121's `chrome-style.js` hunk applied and this commit reverted, at
1200: `--lf-sidebar-edge` 0, `--lf-room` 686, column 686. With both
applied, at the derived 1234px page: column 720, sidebar left 0, rail on
screen, `sideways` 0.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33327907308)

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
… after the chrome change (#138)

## Problem

[Run
33327310444](https://github.com/max-sixty/leaf/actions/runs/33327310444)
on d2dd825 failed with 34 tests red. Most of them are owned: #121 has
the `scrollbar-gutter` set, #132 the generic CONTROL contract, #134 the
catalog stills, #136 the sidebar width, #137 the versions menu, and #133
tracks the digest. What was left unowned is five tests that all fail on
one surface — what the panel's opening does to the page around it — and
each is a reading
[335bf9a](335bf9a)
"Delegate page chrome to browser standards" moved without a second
reading moving with it. All five pass at 335bf9a's parent; each was
reproduced at `-n0` before it was touched.

## Solution

Four readings, each corrected where it is taken. No assertion is
loosened and no test is changed.

**The margin's 900px floor asks the window again.** That number is half
of a pair: `@container lf-shell (min-width: 900px)` grants the rail and
the marker's strip, and `@media screen and (max-width: 899px)` stops
drawing the living margin at all. 335bf9a converted the grant to a
container query and left the hide a media query, so the two came apart
the moment the panel narrowed body: at 1200px with the panel open the
shell is 765px, the grant lapsed, and the markers stayed on screen with
no strip reserved for them. Measured on `SUGGESTION_PAGE`, `--strip-r`
resolved to `max(0px, 0px, 0px, 0px)` and every suggestion's control row
docked beside an empty rail. The floors below it stay container queries:
1152 and 1416 ask how much room is left beside the panel, which is the
question the runtime's old `data-lf-cramped` veto asked, and their
answer is supposed to move with the panel.

**Body's inline size is back under the layout observer.** 335bf9a
dropped `layoutSizes.observe(document.body)`, and with it the only thing
that re-ran `syncLayout` while the panel's eased margin was still
narrowing the page. `setPanel` runs one synchronous pass at the press,
reads the wide box, and returns; nothing reads the narrow one. So a
composer placed in a wide window's margin kept a place the narrowed page
no longer had — an absolute child past body's client box, which is
sideways-scrollable overflow, with the box standing on the panel that
displaced it. Restored with the content-box width filter the removed
code carried, so ordinary document-height growth still does not feed
back into a writer that reserves flow content.

**The panel layer is shown before anything is rendered into it.** The
panel is a `<dialog>` now, and a dialog nobody has shown is `display:
none` — but `setPanel` called `renderPanel()` first and
`syncPanelLayer()` (which calls `show()`) second. `renderPanel` is where
the anchor pass runs for the threads it draws, and a mark hangs on the
boxes its element shows through, so a widget an agent sent in a reply
resolved to an element measuring 0×0, took no mark, and never got one
afterwards: the thread stayed open in the panel pointing at nothing on
either side. Swapping the two lines is the whole fix; the focus target
is `threadsBox`, which the render fills rather than replaces.

**The margin preview shows without naming the marker as its source.**
`showPopover({source})` puts the card in the sequential focus order
directly after the control that invoked it — but this card is not
invoked. It opens on the marker merely taking focus, so a reader walking
the margin was made to Tab through a close button and two preview
actions they had not asked for, three stops between one suggestion's
controls and the next, with the card's contents changing under them as
they went. Its position comes from the `anchor-name` the code already
writes on the button, so the placement asks nothing of `source`.

## Testing

- Everyday suite green on this branch: `uv run pytest tests` — 723
passed, 6 skipped.
- The five: `test_suggestion_controls_stay_out_of_the_column`,
`test_suggestions_sharing_a_block_keep_source_and_keyboard_order`,
`test_a_settlement_in_a_reply_leaves_its_own_anchor_on_the_page`,
`test_a_mark_in_the_layer_promises_no_press_the_layer_will_not_take`,
`test_a_float_the_panel_displaces_hands_the_page_no_sideways_scroll` —
all pass with `--run-nightly`.
- Whole files: `test_render_margin.py`, `test_render_conversations.py`,
`test_render_widgets.py`, `test_render_outbox.py`,
`test_render_navigation.py` — the only failures left in them are ones
that also fail on `origin/main` unchanged, at identical values.
- `prettier --check` and `node --check` pass on both JavaScript files;
CSS is prettier-excluded here by `.pre-commit-config.yaml`.

<details><summary>How each was measured</summary>

The margin floor, on `SUGGESTION_PAGE` at 1200×900, before and after
pressing Threads:

```
BEFORE  bodyRight 1185  main 768  --strip-r "max(0px, 250px, 0px, 0px)"  --claim-rail 250px
AFTER   bodyRight  765  main 765  --strip-r "max(0px, 0px, 0px, 0px)"    --claim-rail ""
```

The same probe at 335bf9a's parent reports `--claim-rail: 250px` in both
postures, with `data-lf-cramped` standing — d226ee2 had already taken
that veto off the rail claim, so the 900 floor was the window's question
and nothing else.

The float, on `LONG_PAGE` at 1600×900 with the composer in the margin
and the panel opened:

```
body.scrollWidth 1487   body.clientWidth 1165   composer.left 1166.9   composer.right 1486.9
```

The mark, on `REPLY_TRAVEL_PAGE` with an `lf-options` frozen into a
reply: `#tv-decision` is present and `checkVisibility()` is true once
the panel is open, its box 355×32, and `.lf-mark-el` is on nothing — at
+6s as much as at +0. The same probe at 335bf9a's parent has the mark
the moment the panel opens.

The tab walk from a suggestion's Accept, before: accept → reject →
marker → **preview close → preview action → preview action** → next
row's accept.

</details>

## What this does not fix

Two of the four groups #127 recorded are still open, and both are a
product decision rather than a stale reading.

- **A covering panel is a modal dialog now**, so the document behind it
is inert:
`test_selection_hints_do_not_name_page_content_behind_a_covering_panel`
presses `s` at 700×900 and gets no hints because the page cannot hear
the key. Whether a covering panel should take the page out of reach
entirely, or cover it and leave it working, is the call —
`test_coarse_pointer_chrome_gives_its_compact_controls_humane_aims`,
`test_workspaces_replace_each_other_instead_of_stacking[500]` and
`test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll`
fail as `<dialog … class="lf-ui lf-panel open"> intercepts pointer
events` on the same fact.
- **Escape belongs to whichever layer the browser is holding** — the
four `test_render_anchors.py` failures and
`test_esc_hands_the_page_back_after_it_has_closed_the_last_panel`. #137
is open on this.

Separately, [0d7e0d0](0d7e0d0)
"Open threads beside their source" landed while this was being verified
and brought two of its own new tests red on `main` —
`test_the_shipped_long_thread_opens_beside_its_source_in_the_right_margin`
and
`test_the_full_thread_posture_follows_the_page_container_and_left_claims`.
They fail identically with and without this branch's changes; noted here
so the next run does not re-derive them.

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33327310444)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
#141)

## Problem

[`ci` run
33327519405](https://github.com/max-sixty/leaf/actions/runs/33327519405)
on e7299eb failed with 33 tests red. One of them is
`test_render_controls.py::test_esc_hands_the_page_back_after_it_has_closed_the_last_panel`,
which #133 lists among the unowned remainder ("`esc` handback"). It
still reproduces deterministically on `main` at 1ca4f40, in about 7
seconds.

The test's first assertion after a pointer open is the one that fails:
the panel is visible and the toggle is no longer focused.

```
FAILED tests/test_render_controls.py::test_esc_hands_the_page_back_after_it_has_closed_the_last_panel
E       AssertionError: Locator expected to be focused
E       Actual value: inactive
E         - waiting for locator(".lf-threads-toggle")
E           14 × locator resolved to <button aria-expanded="true" class="lf-btn lf-threads-toggle" ...>
tests/test_render_controls.py:2089
```

`syncPanelLayer` raises the panel with `panel.show()` beside the page
and `panel.showModal()` over it. Both run the dialog focusing steps, so
the browser moves focus into the dialog whichever one is called — the
panel takes the focus off whatever raised it. The function already knew
to put focus back, but only for a focus it found *inside* the panel:
`active` is `null` whenever the reader was standing outside it, and the
restore arm reads `active`. So the pointer route lost the toggle, and
what the test's docstring bills for lands: the button holds
`aria-expanded` with no ring on it, and the reader's next Space is that
button rather than the page's scroll — the panel they dismissed comes
back and nothing says why.

## Solution

Carry the element that was standing outside the layer alongside the one
found inside it, and restore that too when nothing else claims the
focus. Beside the page a panel is a column that arrived, so the reader
stays where they were; a covering panel is a mode and still takes them
in, which is the existing `focusEnteredLayer` arm and is unchanged. Body
is not somewhere to put anyone back, so it is not carried.

This is `syncPanelLayer`'s own restore, extended to the case it did not
name — not a second focus policy beside it, and not a call at the press
site, which would have to be repeated at every door the panel has.

## Scope

Not the other 32. Measured against the current tip, they are owned or
out of reach here:

| | |
| --- | --- |
| #121 | 8 of them (`scrollbar-gutter: stable` on the root scroller) |
| #132 | `test_example_renders[command-hub]`,
`test_example_renders[corpus]` |
| #137 | the four version-menu cases in `test_render_anchors.py` |
| #134 / #133 | the catalog preview digest |
| this PR | `esc` handback |

I reached the version-menu focus break independently and had the same
one-line fix (`versionBtn.focus()` before `showPopover`) before #137
appeared; #137 covers it and the two contracts around it, so nothing of
it is here.

<details><summary>How the split was measured</summary>

Each row is a local `-n0` or `-n3` run on the named tree, not an
inference from the failure text.

- The 33 node ids from the run were re-run on `main` (26dbf42): 31 still
failed. Applying #121's `chrome-style.js` hunk alone took that to 23;
adding #132's branch took it to 20.
- #138 also edits `chrome-layout.js`, so its hunk was applied to `main`
on its own and the `esc` test re-run against it — still red. The two
changes are in different functions (`setPanel` and the `ResizeObserver`
there, `syncPanelLayer` here) and do not overlap.
- Four failures that appeared only under `-n3` —
`test_render_navigation.py::test_a_label_press_keeps_the_controls_keyboard_standing`,
`test_render_outbox.py::test_a_withdrawal_restores_what_still_stands_not_what_stood_then`,
`test_render_startup.py::test_a_fast_first_replay_does_not_flash_the_waiting_surface`
and
`test_render_controls.py::test_covering_panel_takes_the_page_scroll_with_it`
— each pass at `-n0` on both trees, or fail on both. None of them is
this change.

</details>

## Testing

`test_esc_hands_the_page_back_after_it_has_closed_the_last_panel` is the
regression: it asserts both halves the docstring names — the ring the
pointer reader never asked for, and the Space that reopens what they
just dismissed — and it goes from red to green here. No new test,
because that one already owns the behaviour.

<details><summary>Runs on this branch, against the same files on clean
1ca4f40</summary>

```
uv run pytest tests -q -n3                      723 passed, 6 skipped
uv run pytest tests/test_render_controls.py \
             tests/test_render_conversations.py 10 failed, 101 passed
uv run pytest tests/test_render_outbox.py \
             tests/test_render_margin.py \
             tests/test_render_drafts.py         3 failed, 108 passed
```

Every remaining failure above reproduces on clean `main`;
`test_esc_hands_the_page_back_after_it_has_closed_the_last_panel` is the
only test whose result this change moves. Earlier on 26dbf42 the wider
render set (`anchors`, `gate`, `navigation`, `widgets`, `projection`,
`startup`, `drafts`, `outbox`, `options`, `pages`, `aim`, `reactions`,
`margin`, `semantic_selection`, `commands`, `export`, `site`) ran the
same way with the same result.

</details>

---

Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33327519405)

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
)

## Problem

`test_render_gate.py::test_example_renders[corpus]` has been red on
every `ci` run since
[26dbf42](26dbf42)
"Add external link treatment", in both colour schemes, and it still
reproduces deterministically on `1ca4f40` in 11 seconds. #132 diagnosed
it as "a different finding, from 26dbf42's external-link treatment
rather than from 335bf9a" and left it; no PR or issue owns it.

```
assert ['[light] <lf-tab id=corpus-pr-walkthrough> puts "opens in a new tab" under .lf-ui, where no comment can reach it',
        '[dark] ...same...'] == []
```

The subject is not the example. `render_version` is the pass `version
check --render` runs on an agent-authored page, so any page with a
cross-origin link inside a widget now fails handover on a word the
reader is never shown.


[`unreachableWords`](https://github.com/max-sixty/leaf/blob/03b4a0b2776102041a2d48580046fbf03b5e3446/skills/leaf/scripts/leaf/render-checks/reachability.js#L208)
walks every text node under a widget's `.lf-ui` and reports the ones no
declaration claims. Its excuse list held `.lf-quiet` and nothing else.
26dbf42's `renderExternalLinks` writes a note beside each external link
— `class="lf-ui lf-external-note"`, `hidden`, textContent "opens in a
new tab" — as the `aria-describedby` target for the link, and the walk
found it: not `data-lf-said`, not inside the link's own `CONTROL` box (a
describedby target is referenced by id, so it sits beside the link
rather than in it), not `.lf-quiet`.

## Solution

Excuse `[hidden]` beside `.lf-quiet`, one line and its comment. The
check's own opening sentence is "Words the page shows that no user can
select", and a `[hidden]` subtree shows none.

The note cannot simply become a `.lf-quiet` word instead — which would
have been the tidier answer, since `quietWord` is the repo's one idiom
for "a word for a reader listening, silent on screen".
`renderExternalLinks` is enrolled on declared shadow roots as well as
the document, and the note is placed inside whatever root its link
stands in, while `.lf-quiet`'s clip is a rule in the document stylesheet
that no shadow tree adopts (only `MARK_RULES` is adopted, in
`shadow.js`). A `.lf-quiet` note in an `x-shadow` widget would render as
visible text next to the link. `hidden` is the silence available in
every root.

`[hidden]` is safe for this reading to trust rather than a hole for
hidden-but-revealable words: the browser removes the attribute when it
reveals `hidden="until-found"` content, so a word the reader finds is a
word this check sees again, at the moment it is on screen. The two
sibling gate readings that ask what a box shows already spell the same
pair —
[`widgets.js`](https://github.com/max-sixty/leaf/blob/03b4a0b2776102041a2d48580046fbf03b5e3446/skills/leaf/scripts/leaf/render-checks/widgets.js#L146)
and
[`standalone.js`](https://github.com/max-sixty/leaf/blob/03b4a0b2776102041a2d48580046fbf03b5e3446/skills/leaf/scripts/leaf/render-checks/standalone.js#L34).

No assertion is loosened and no runtime file is touched.
`skills/leaf/CLAUDE.md`'s row for this gate already reads "**visible**
page words remain in reachable flow".

## Testing

- `test_example_renders[corpus]` and
`test_example_renders[pr-walkthrough]` — pass with `--run-nightly`; the
first fails on `origin/main` unchanged at the two findings above.
- `test_render_reports_words_a_widget_puts_out_of_reach` gains the pair:
the same `.lf-ui` note inside `lf-option` reports nothing when `hidden`
and is still reported when shown. Bug-back: with the `[hidden]` excuse
reverted, the hidden half fails with exactly the corpus's finding.
- `uv run pytest tests` — 723 passed, 6 skipped, on this branch rebased
onto `c7b3706`.
- `uv run pytest tests/test_render_commands.py tests/test_render_gate.py
--run-nightly` — 77 passed, 4 failed, and all four are in the failed
run's own list and owned elsewhere:
`test_the_render_gate_measures_sideways_room_at_the_root_scrollport`,
`test_the_reader_draws_an_edge_to_the_width_they_want[comments]` and
`test_a_window_with_no_room_for_a_chosen_width_does_not_un_choose_it[comments]`
are #121's `-15`, and
`test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive`
is the intermittent one #121 documents.
- `node --check`, pinned `prettier --check`, `ruff check` and `ruff
format --check` pass on the two touched files. `pre-commit` is not on
this sandbox's PATH, so its remaining hooks went unrun here.

The preview digest is unmoved: `capture_input_files()` hashes
`examples/`, `skills/leaf/assets`, the selected packages and three site
scripts, and `skills/leaf/scripts/` is in none of them.

## What this does not fix

The failed run had 32 red. Everything else in it sits with an open PR or
issue — #121, #132, #134, #136, #137, #138, #140, #141, and issues #133
and #139 — with two exceptions I did not reach:

-
`test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`
reports one unlit ring, `version-diff
(.lf-version-diff:is(:focus-visible, .lf-focus-visible))`. That control
is inside the versions menu #137 is rewriting, so it is likely
downstream of that branch rather than its own cause; I have not verified
it against #137's tree.
-
`test_render_navigation.py::test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it`
is the generic-press question #132 raised and deliberately left as a
product decision.

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33330752582)

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
…p's own press (#140)

## Problem

Two leftovers from
[335bf9a](335bf9a)
"Delegate page chrome to browser standards", which moved control
activation off a page-wide `CONTROL` scope and into rows declared where
each control is. Both are on `ci`'s red list for [the run this was
dispatched
for](https://github.com/max-sixty/leaf/actions/runs/33328596524) or
reachable from the same change, and both still reproduce at `1ca4f40`.

**`lf-worktree`'s head names fewer keys than work it.** The commit gave
the head a row binding `PRESS` — Enter and Space — over a button wearing
`aria-expanded`, which is ARIA's disclosure pattern.
`skills/leaf/CLAUDE.md` states what that costs: "every row over a
disclosure reads [`DISCLOSE`] — this scope's, and a widget's own row
re-wording the same press. Two rows naming different sets is not two
promises but one: `lineRows` prints the nearer row and drops the other
whole, so a widget naming one key fewer takes the rest off the line".
The widget row is nearer, so the arrow that opens the evidence went on
working and stopped being named — on the key line and in
`aria-keyshortcuts`, which is written once when the scope is declared
and so froze at `Enter Space`. Nothing tested it; the identical bug in
`lf-options` is what [#132](#132)
is for, and that PR does not reach this package.

**`test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it`
still asks for the deleted scope's word.** It asserts the key line reads
`press it` over a focused tab. `press it` was `CONTROL`'s `line`, and
335bf9a removed the scope in the same commit that gave `lf-tabs` its own
`tab.activate` row reading `open the tab`. The commit updated several
tests in that file and dropped
`test_the_reference_names_the_space_that_works_a_control` outright; this
assertion was missed, so the test fails before reaching the two facts it
exists to hold.

## Solution

`lf-worktree`'s head takes its keys from `DISCLOSE(head)`, the way
`lf-diff` and `lf-draft` already do, and keeps its own `run`. `DISCLOSE`
hands over only the arrow that changes the state, so the press stays a
direction rather than a second toggle; it also answers for where the
head stands, and the runtime's disclosure scope stops at the chrome. The
head is a span from `selectableOffer`, so a copy frozen into thread
markup has no platform pair underneath it the way a `details > summary`
does — the row's own press is the only thing there, which is the shape
[#132](#132) keeps for the sibling
widget. Its `line` reads the way the tree is standing, and
`aria-expanded` is written at birth so the head is never briefly a
control the runtime cannot place — without that write `DISCLOSE` hands
back both arrows, and that is the value `aria-keyshortcuts` is written
with when the scope is declared. The repaint that keeps the line and
`aria-keyshortcuts` together is the document's disclosure watch, which
[#132](#132) moved from
`paintHere()` to `paintKeys()` while this branch was open; the widget
owes none of its own, which is what `skills/leaf/CLAUDE.md` now says in
as many words.

The tabs test asserts `open the tab` — the strip's own word for the same
press — and its docstring now describes where that press is declared
rather than the scope that used to supply it. Everything after the
assertion is unchanged: Enter still has to re-select the focused tab,
and Space still has to be consumed rather than scrolling the page out
from under it.

New coverage in `test_render_projection.py` for the worktree head, since
nothing exercised it. It holds the row rather than the repaint: on the
page, both surfaces naming the row's keys — the line and
`aria-keyshortcuts` — plus a second `→` on an open tree, so a scope
answering nothing at all could not pass it. In a message: the same head
in the threads panel, where `aria-keyshortcuts` reads `Enter Space`, the
arrow moves nothing, and Enter and Space fold it. The repaint behind
both surfaces is held by
`test_a_widgets_native_control_names_the_press_the_platform_makes`,
which #132 added.

## Testing

`uv run pytest tests` at `c292244` — 723 passed, 6 skipped. After
merging `main` (which brought #132 and #143) and taking the repaint out
at `890e7ff`, `test_render_projection.py`, `test_render_navigation.py`,
and `test_render_anchors.py` — 193 passed, 4 failed, all four the
version-menu group [#137](#137)
owns and all four failing identically on `origin/main` in a clean
worktree. With `--run-nightly`, `test_render_projection.py` and
`test_render_navigation.py` — 137 passed, 1 failed, that one being
`test_the_arrows_say_which_way_the_section_under_the_reader_goes`, which
is #132's settled ask and untouched here; it fails the same way at the
merge base `1ca4f40`.

Each half of the new test was run against the code it holds and fails
there: the page half at `assert 'Enter Space' == 'Enter Space
ArrowRight'` on `main`'s `lf-worktree.js`, and the thread-markup half at
`aria-expanded` staying `"false"` under Enter with the row's `run`
removed.

<details><summary>What this does not fix in that run</summary>

The run reported 34 failures. Most of the rest already have a PR open:
the `-15` root scrollbar-gutter family is
[#121](#121) (`assert -15 == 0`,
the drawn edge landing a bar's width off the hand, the covering panel's
blank strip), the version-menu group is
[#137](#137), the settled ask's
disclosure keys were [#132](#132),
now merged, the margin and float placements are
[#138](#138), the gallery stills
are [#134](#134), and the
sidebar's stated window is
[#136](#136).

No guard stops the third widget from declaring a fixed key pair over a
disclosure. `DISCLOSE` exists so the two surfaces cannot come apart, but
a widget has to remember to call it, and two of the four widgets over a
disclosure did not. A corpus-wide check — every focusable disclosure
names the keys `DISCLOSE` gives it — would catch the next one, and is
left out of this PR because it belongs beside the corpus checks rather
than in a fix for two widgets.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33328596524)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
## Problem


[335bf9a](335bf9a)
made `.lf-panel` a `<dialog>` and `syncPanelLayer` raised it with
`showModal()` whenever it covers the page. A modal dialog makes the rest
of the document inert, and covering is the posture in which the page
most needs to stay live — so the banner toggle that opened the panel
stopped closing it, the decisions toggle beside it stopped switching
workspace, and the strip of page still showing beside the sheet stopped
answering a selection hint. Separately, both `show()` and `showModal()`
run the browser's dialog focusing steps, so opening the panel took focus
off the control that opened it.

Those are the six unowned tests in #139. Five are the inertness; the
sixth is the focus.

## Solution

The panel is shown, never shown modally, at either posture, and the
invoker gets its focus back. What modality was carrying is already owned
elsewhere and stays: the covering sheet's root scroll lock is the
stylesheet's `overflow-y: hidden` under `COVERING`, and Escape is the
ladder's — `browserDismissesTopLayer` hands Escape to the platform only
for layers the platform really owns, which the keyboard reference and
the page map sheet still are. `skills/leaf/CLAUDE.md` already states the
same reading from the other direction: `presentPage` demotes authored
`showModal()` calls to non-modal dialogs precisely so a modal's
top-layer inertness cannot disable the recovery chrome.

That deletes rather than adds machinery: `panelModal`,
`ignoreNextClose`, the close-and-reopen across the covering breakpoint,
the `resize` and `change` re-syncs that existed only to switch modality,
the `panelFocusTarget` wiring, and the `close` listener that only a
native modal dismissal could reach. `syncPanelLayer` becomes
`showPanelLayer`, called once from `setPanel` — still before
`renderPanel`, for the reason #138 gave it.

The one user-visible consequence is the scrim: a non-modal dialog paints
no `::backdrop`, so the `.lf-panel::backdrop` rule goes with it. That
reads as the point rather than a cost — a scrim over a page the reader
can now press would be saying the opposite of what the page does.

## Which of the six this closes

Measured on this branch, rebased on `main` at 0b7f148 (so #121, #138 and
#141 are in the base).

| test | |
| --- | --- |
|
`test_selection_hints_do_not_name_page_content_behind_a_covering_panel`
| green |
| `test_workspaces_replace_each_other_instead_of_stacking[500]` | green
|
| `test_coarse_pointer_chrome_gives_its_compact_controls_humane_aims` |
green |
| `test_esc_hands_the_page_back_after_it_has_closed_the_last_panel` |
green — already fixed on `main` by #141, kept green here |
| `test_the_responsive_action_shelf_keeps_primary_actions_in_reach` |
green |
|
`test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll`
| past its modal failure, red on one that is now `main`'s — see below |

## What this does not fix


`test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll`
needed both this and #121, and with both it is still red — on a
different, earlier failure that #121 brought and this change does not
touch. Walking it forward, each row a local `-n0` run:

| tree | first failure |
| --- | --- |
| `main` at 1ca4f40 (pre-#121) | line 1017, `.lf-decisions` click —
`<dialog … class="lf-ui lf-panel open"> intercepts pointer events` |
| 1ca4f40 + this | line 1077, `assert edge["left"] >= -0.1` → `-12` |
| 1ca4f40 + #121 | line 1006, `wait_for_function` on `.lf-threads`
`scrollTop` after a touch swipe |
| `main` post-#121 | line 1006, same |
| `main` at 0b7f148 + this | line 1006, same |

Line 1006 is *earlier* than the failures the modal caused, so it was
masked until #121 landed; it is green on 1ca4f40 and on 1ca4f40 + this.
It belongs to #121's `overflow-y: scroll`, is live on `main` now, and
needs its own fix.

## Relation to #141

#141 landed while this was being measured. It fixed the focus half by
extending `syncPanelLayer`'s restore arm while keeping `showModal()`, so
`test_esc_hands_the_page_back_after_it_has_closed_the_last_panel` is
already green on `main`; this rebases onto it and replaces that arm
rather than competing with it. With modality gone the restore has one
case instead of four, and `focusEnteredLayer`, `panelFocusTarget` and
`returning` all go with it.

## Testing

<details><summary>Runs</summary>

On `main` at 0b7f148:

```
uv run pytest tests -q                                     724 passed, 6 skipped
uv run pytest --run-nightly -n2 <the six, 7 node ids>      6 passed, 1 failed
```

The one failure is the row above. Earlier, on the pre-rebase base
(1ca4f40), the owning files ran `5 failed, 77 passed` for
`test_render_controls.py` + `test_render_semantic_selection.py` and `2
failed, 45 passed` for `test_render_conversations.py`; every one of
those seven reproduced identically on clean `main` — five of the
reserved-gutter shape #121 has since taken, plus
`test_a_settlement_in_a_reply_leaves_its_own_anchor_on_the_page` and
`test_a_mark_in_the_layer_promises_no_press_the_layer_will_not_take`,
which are unrelated and untouched here.

No new test: the six already own the behaviour, and each names it in its
own docstring.

</details>

<details><summary>The visual delta, measured rather than
described</summary>

Same fixture, same viewport, same state — `LONG_PAGE` at 700×900 with
the Threads panel open, which is the covering posture. Panel geometry is
identical across the two (`x=265 y=96 w=420 h=804`); `dialog:modal`
reads `true` before and `false` after.

Every pixel outside the panel changes, and only by the scrim coming off:

```
left-of-panel differing px: 238500 of 238500   (222,221,219) -> (250,249,246)
panel-region differing px:   43380 of 391500   the banner band above the panel, same two colours
```

`(222,221,219)` is paper under `color-mix(in srgb, var(--ink) 12%,
transparent)`; `(250,249,246)` is paper. The banner was inside the
dimmed area too, which is the visible half of the bug: the chrome the
reader closes the panel from was drawn as if it were unavailable, and it
was.

</details>

---
Closes #139

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