Skip to content

Fix stale control selectors and room readings after the chrome change - #127

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

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

335bf9a "Delegate page chrome to browser standards" took ci on main from 13 failures to 60 (run 33317065355). The 13 are the standing scrollbar-gutter set that #121 already covers — I confirmed them against the run on 01ec4f4, 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.

The four remaining groups

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.


Automated fix for failed run

`Delegate page chrome to browser standards` moved widget controls from spans
wearing an ARIA role to native elements, and the page's strips and room from
runtime measurement to CSS the shell resolves. Both moves left readings behind
that still ask the old question, and each one fails silently rather than
loudly: a `[role=button]` selector matches nothing now that `offer` builds a
`<button>`, and `getComputedStyle(el).getPropertyValue('--lf-room')` is the
unresolved expression rather than a length, so `parseFloat` is NaN and every
comparison against it is false.

- `lf-suggestion` finds its own two controls again, so a decision relabels them
  ("✓ Accepted"), reserves the room the longer word needs, and the margin item
  can put the reader on one.
- `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 the ask walk landed on the first offered control in the
  document rather than on the decision it was sent to.
- The margin preview suppresses its entry on `beforetoggle`, so the focus the
  platform returns to the marker mid-dismissal does not re-show the card from
  inside its own hide — an uncaught `InvalidStateError` on every Escape.
- The two `--claim-map` grants hold their conditions in `:where()`, so document
  order decides between them. Counted, the narrow rail's condition outranked the
  card's and a page with a thread on it never widened its margin.
- The render gate's `withheldRoom` and the `bake` control sweep read what they
  meant to: room through a probe the layout sizes, and controls through a valued
  offer marker rather than the bare attribute, which was removing the box a
  suggestion hangs its ✓/✗ row in and taking a decided change's record with it.

Tests read the same two facts the same way: a probe for `--strip-r` and
`--lf-room`, and `[data-lf-offer=button]` for a control whose element the layer
now chooses.

@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.

Traced all six corrections against the merged tree and each one holds, including the two whose reasoning I most expected to be off: closePreview does set previewEntry = null before it calls hidePopover(), so the beforetoggle guard genuinely isolates the platform's own dismissal; and the :where() pair does land both grants on (0,0,2), so document order hands the 1152px card rule the win it was already arranged to have. The probe in withheldRoom reads the right value where it stands, too — 100cqi still resolves against body's lf-shell container from inside the drawing, and lf-diagram, the only tag declaring x-wide: drawing, draws no frame of its own, so the child probe never picks up the --lf-frame reset's zero by mistake.

One thing left behind by the bake change.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

ci failed again on main — run 33320236376 on 3431cc2 ("Standardize vertical-list edges (#124)"), 62 failed / 1464 passed. It is this branch's failure, not a new one: 57 of the 60 node ids from run 33317065355 — the run this PR was written against — recur verbatim, and each of the five that are new to the list passes on this branch's head (8b869c9).

No new work needed here as far as I can tell; recording the run so the branch carries its own evidence.

The five-test delta, and how each resolves

Set comparison over FAILED <nodeid> lines from both runs' --log-failed:

New on 3431cc2 (5): test_render_margin.py::test_g_addresses_the_shipped_reconnect_thread_in_the_page_map, test_render_projection.py::test_the_render_gate_reports_a_server_that_stops_answering, test_render_widgets.py::test_a_decided_change_folds_away_rather_than_vanishing, test_render_widgets.py::test_a_key_walks_the_page_s_open_asks, test_render_widgets.py::test_a_wait_the_reader_would_notice_says_so_and_a_short_one_says_nothing

Gone since 33317065355 (3): test_render_controls.py::test_covering_panel_takes_the_page_scroll_with_it, test_render_controls.py::test_motion_preference_changes_are_heard_without_reloading, test_render_widgets.py::test_a_key_walks_the_page_s_open_decisions

Two of the five are renames rather than arrivals — 5d945ed renamed test_a_key_walks_the_page_s_open_decisions to ..._open_asks and added the page-map case, which b314c1a then renamed again to test_g_addresses_the_shipped_page_map_in_its_announced_order. The other three are the suggestion-control cluster this branch's bake and [data-lf-offer] changes target: #sug[data-lf-state='accept'] never appearing, the decision walk finding no control, the gate's stalled-file probe.

Run on this branch's head, on the CI Linux sandbox:

$ uv run pytest --run-nightly -q -n0 -p no:randomly \
    tests/test_render_margin.py::test_g_addresses_the_shipped_page_map_in_its_announced_order \
    tests/test_render_widgets.py::test_a_key_walks_the_page_s_open_asks \
    tests/test_render_widgets.py::test_a_decided_change_folds_away_rather_than_vanishing \
    tests/test_render_widgets.py::test_a_wait_the_reader_would_notice_says_so_and_a_short_one_says_nothing \
    tests/test_render_projection.py::test_the_render_gate_reports_a_server_that_stops_answering
5 passed in 18.32s

The branch already sits on b314c1a, the current tip, so nothing needs rebasing. The nineteen groups this PR's description leaves open are unaffected by any of the above — main stays red after this merges until those land.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for run 33317627057 on 5d945ed, which sits between this PR's own run and the 3431cc2 run recorded above — same failure, already bracketed by that comparison, so nothing new to record about the run itself.

One thing for the first of the four open groups, though: the render gate under-reports it. The 16 findings it names are the ones inside a widget's own subtree; a control a widget hoists into the living margin escapes the check entirely, because unreachableWords roots its [data-lf-said]-in-a-form-control loop at the nearest LF-* ancestor and a hoisted row has none. lf-suggestion's own decided word is exactly that case — so this branch ships a ✓ Accepted no selection can reach, and no probe says so.

Measured on this branch's head (8b869c9)

DECISIONS_PAGE, accept #sug-refill, then read the control the decision relabelled:

{'tag': 'BUTTON', 'said': True,
 'chain': ['button', 'span', 'div', 'main', 'body', 'html'],
 'nearestLfAncestor': None}

data-lf-said on a native <button> — the shape group 1 is about — and no LF-* ancestor, because registerMarginItem hoists .lf-sug-actions out of the element and into the column. So reachability.js:268 continues on it, and unreachableWords() returns [] both before and after the decision. lf-suggestion's own comment is the claim it contradicts: "A decided control's word is the page speaking … so it is quotable."

The migration back is tractable, at least here. selectableOffer("button", …) for the two controls plus one row-scoped PRESS declaration — the shape lf-tabs and lf-options already use — leaves test_a_key_walks_the_page_s_open_asks passing on its original span lf-sug-accept expectation rather than needing the tag updated, and test_a_control_in_a_reply_holds_its_room_and_leaves_the_page_s_rail_alone passes with it. Measured on main at 07373f4 with this PR's two selector corrections applied: 14 of the 56 still-failing tests there go green, which is the same direction this branch reports.

Not proposing it as a change to this PR — which layer owns the press, and whether the gate's rooting should follow a hoisted control back to its widget, are both yours. Recording it so group 1 isn't scoped to the 16 findings the gate happens to name.

The paragraphs over the standalone copy's control removal still described the
old chrome: a tab stop wearing an injected role, told apart by DECISION_CONTROL.
`offer` builds a native <button> and writes no tabindex, and DECISION_CONTROL's
second alternative now matches an empty-marker box the loop deliberately spares,
so the section stated two contradictory rules for one loop. Say what `offer` and
`selectableOffer` write and when, and drop the citation whose set diverged.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

ci failed again on main — run 33321580100 on b314c1a ("Address every page-map item (#126)"), 59 failed / 1468 passed. Same failure as the two runs already recorded above, so I ran that run's whole node-id list against this branch merged onto current main (6794ddc — the merge is clean) rather than record a fourth "still the same". The 59 split four ways, and between this branch, #121 and #129 the whole list is now accounted for:

count where it lands
green on this branch 27 merging this closes them
standing before 335bf9a 12 the gutter set this PR's description assigns to #121
test_the_chrome_a_key_opens_has_no_serious_violations[420-light|dark] 2 #129
still red, unowned 18 this PR's four open groups

So main goes from 59 to 18 once those three land, and the 18 are exactly the groups whose resolution this PR says is yours to decide. Nothing here needs a change to this branch.

Method, the 18, and one caveat

Worktree at this branch's head (e0ab081) with origin/main merged in (clean, no conflicts), then run 33321580100's 59 FAILED node ids passed to pytest in one go on the CI Linux sandbox:

$ uv run pytest --run-nightly -q -p no:randomly $(cat nodes.txt)
32 failed, 27 passed in 351.58s (0:05:51)

The 32 were then sorted against run 33297425217 on 01ec4f4, the commit before 335bf9a: 12 of that run's 13 recur here (the thirteenth, test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive, now passes), leaving 20 new since the chrome commit — the two axe cases plus these 18:

tests/test_render_anchors.py::test_a_row_the_platform_activates_names_both_of_its_keys
tests/test_render_anchors.py::test_the_menu_a_first_version_opens_is_a_menu_it_can_close
tests/test_render_anchors.py::test_the_version_menu_is_worked_by_pointer_and_key
tests/test_render_anchors.py::test_the_versions_menu_suspends_the_pages_own_keys
tests/test_render_controls.py::test_coarse_pointer_chrome_gives_its_compact_controls_humane_aims
tests/test_render_controls.py::test_esc_hands_the_page_back_after_it_has_closed_the_last_panel
tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
tests/test_render_controls.py::test_workspaces_replace_each_other_instead_of_stacking[500]
tests/test_render_conversations.py::test_a_mark_in_the_layer_promises_no_press_the_layer_will_not_take
tests/test_render_conversations.py::test_a_settlement_in_a_reply_leaves_its_own_anchor_on_the_page
tests/test_render_gate.py::test_example_renders[command-hub]
tests/test_render_gate.py::test_example_renders[gallery]
tests/test_render_navigation.py::test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it
tests/test_render_navigation.py::test_the_arrows_say_which_way_the_section_under_the_reader_goes
tests/test_render_outbox.py::test_a_float_the_panel_displaces_hands_the_page_no_sideways_scroll
tests/test_render_semantic_selection.py::test_selection_hints_do_not_name_page_content_behind_a_covering_panel
tests/test_render_widgets.py::test_suggestion_controls_stay_out_of_the_column
tests/test_render_widgets.py::test_suggestions_sharing_a_block_keep_source_and_keyboard_order

That is one fewer than the nineteen the description lists, and the difference is the caveat: test_covering_panel_takes_the_page_scroll_with_it is not in run 33321580100's list and passed on the merged branch here, but it fails on plain main at 6794ddc when I run it alone — Page.wait_for_function timeout, identically with and without an unrelated local change. So it is still red and still yours; it just moves in and out of a given run's list rather than sitting in it.

I reached #129's two axe cases independently before finding that PR open, arrived at the same root cause, and stopped rather than open a second fix — #129 also reserves the thread list's clearance for the lifted line, which mine did not.

@max-sixty
max-sixty merged commit d2dd825 into main Aug 30, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/ci-33317065355 branch August 30, 2026 18:10
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]>
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
…ry disclosure row's shortcuts (#132)

## Problem

[Run
33324080398](https://github.com/max-sixty/leaf/actions/runs/33324080398)
failed with 63 tests red on 6794ddc. The group #127 recorded as unfixed
under "The generic CONTROL contract went with the old `offer`" was two
readings that went quiet when
[335bf9a](335bf9a)
moved widget chrome onto native elements. **The `selectableOffer` half
has since landed on `main`**, so this branch is only the other one.

335bf9a gave `lf-options`' settled row a `keys()` scope binding `PRESS`.
[`lineRows`](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/runtime/keyboard/keyline.js#L53-L77)
gives a nearer scope only the bindings it names, so the runtime's
disclosure scope was left holding the arrow alone. Standing on a settled
ask, the key line read `⏎ / space` "open or close" beside a stray `→`
"open" — two chips for one press, and neither saying which way this
section goes.

## Solution

**The row's bindings come from `DISCLOSE`.** [leaf.js's note on that
primitive](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/leaf.js#L2428-L2432)
asks for this by name — "a widget's own row re-wording the same press in
its own terms … named once here so the two cannot come to name different
sets" — and the arrows test asks for it in its docstring too. The line
word follows the row the way the runtime's own does, so the two merge
into one chip. The scope's title and `does` string are untouched, which
is what `test_settled_options_collapse_without_going_out_of_reach` asks
of the "?" reference, and the row states `aria-expanded` at birth so the
pair `DISCLOSE` reads is never briefly incomplete.

**And the shortcuts attribute repaints with it — from the watch, not
from the widget.** A row bound through `DISCLOSE` answers from the
disclosure's own state, and that state is named on two surfaces: the
line the reader sees, and the `aria-keyshortcuts` a listener is read.
Only the line had a watch. `keys()` writes the attribute once at
declaration, so an open group's line read `⏎ / space / ← close` while
its attribute still said `Enter Space ArrowRight` — naming the arrow
that no longer moves the section and withholding the one that does, on
the surface a screen reader gets.

The repaint belongs in the [document's disclosure
watch](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/leaf.js#L467-L486)
rather than in `lf-options`. That `MutationObserver` over `open` and
`aria-expanded` is already the thing that hears both spellings of the
write, in the page and in every shadow root `shadowStage` hands it;
[`paintKeys()`](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/runtime/keyboard/scopes.js#L174-L181)
is the superset of the `paintHere()` it was calling, and ends in it. So
one call covers every `DISCLOSE` row at once — including the two that
already existed and had no repaint at all, `lf-diff`'s file summary and
`lf-draft`'s edit history, both of which carried the exact defect
described above on a widget this branch does not touch. `lf-options`
drops its own call and the import behind it, and a widget declaring a
disclosure row owes no repaint of its own.

## Testing

On `0d7e0d0` with nothing applied, then on 0f95be6:

| test | `0d7e0d0` | 0f95be6 |
| --- | --- | --- |
|
`test_render_navigation.py::test_the_arrows_say_which_way_the_section_under_the_reader_goes`
| fail — `⏎ / space` "open or close" then `→` "open" | pass |
|
`test_render_anchors.py::test_a_widgets_native_control_names_the_press_the_platform_makes`
| pass — it did not read the attribute | pass, with the two new readings
|
| `tests/test_render_options.py` (whole file, `--run-nightly`) | 1
failed | 1 failed — the same
`test_a_specimen_holds_a_wide_exhibit_inside_the_column` |

Both tests read `aria-keyshortcuts` **once and unretried**, for the same
reason they already read the line that way: the two-second heartbeat
repaints scopes too, so `expect(...).to_have_attribute` goes green on
whichever tick lands inside its five-second budget. Putting the watch
back on `paintHere()` fails both — `'Enter Space ArrowRight' == 'Enter
Space ArrowLeft'` on the settled row, and the mirror of it on the staged
diff summary.

- `uv run pytest tests` — 723 passed, 6 skipped, on the code as pushed.
(The `skills/leaf/CLAUDE.md` paragraph was written after that run and is
documentation only.)
- `tests/test_render_navigation.py` + `tests/test_render_widgets.py
--run-nightly`: 4 failed, 119 passed — the same four already standing on
this branch's previous head.
- `tests/test_render_anchors.py --run-nightly`: 4 failed, 53 passed; all
four reproduce with these changes reverted, so none is this change.
- `pre-commit run --files` over the four touched files: every hook
passes.

Note that `ci` runs only the everyday suite on a pull request, so this
PR's own checks do not exercise any of the browser tests above.

## Still red on `main`, not addressed here

- `test_example_renders[corpus]` now reports `<lf-tab
id=corpus-pr-walkthrough> puts "opens in a new tab" under .lf-ui` — a
different finding, from 26dbf42's external-link treatment rather than
from 335bf9a.
- `test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it`
asserts the line says "press it" over a tab. That word belonged to the
shared control scope 335bf9a removed, and nothing writes it now —
`lf-tabs` says "open the tab" in its own scope. Restoring a generic
press is a decision about what the layer owes every control, and #128
stands closest to it.
-
`test_site.py::test_the_public_catalog_is_a_visual_index_of_full_page_routes`
— the preview digest, diagnosed in #133. This branch touches no preview
input.

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

---------

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