Repository navigation
Use Web Awesome for chrome copy, search, and filter controls - #918
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The Page Map dialog's search field now draws a visible label. page-map-dialog.js trades its aria-label for dialogSearch.label = "Find an action, status, or location in Page Map", which Web Awesome renders into a form-control-label part, and the clipping rule this PR adds to chrome.css names only .lf-find-box and .lf-thread-state. Measured on a served page after g Shift+M, that label's box is 16.8px tall and carries the whole sentence, directly above a field whose placeholder already reads "Find an action, status, or location"; the two thread-panel controls measure 1px, as intended. Adding .lf-page-map-search to the same :is(...) list clips it while the input keeps its accessible name — suggested inline, and with only that change the label measures 1px and test_the_g_chord_opens_an_empty_page_map and test_global_destinations_switch_from_a_covering_workspace still pass.
Underneath it: skills/leaf/packages/diff/shadow.css already hides a wa-input's label for .lf-diff-search, with display: none on both its label and form-control-label parts. Three adopted wa-inputs now answer the same need three ways, and the one added without a rule is the one that regressed. Whatever the third spelling is, it wants to be one rule the adopting control opts into rather than a per-control selector list that the next adoption has to remember to join.
The second thing is the startup cost, and it is a judgement I'd rather leave to you than decide in a review. CLAUDE.md's Working on the repository asks a change that adds work before presentation to state "the user-visible benefit and why that work cannot wait until after presentation". The description gives the requests, the bytes, and the benefit, but not the second half — and the second half is where this one is interesting, because nothing the chrome entry registers is on screen at presentation. The three copy buttons are alwaysFolded into the overflow menu, the narrowing search and filters are inside the thread panel, and the Page Map search is inside a shut dialog. Meanwhile leaf.js takes the bundle as a static top-level import, and await panelComposer.mount() — which awaits findInput.updateComplete — now runs ahead of the conversation, keyboard, and presentation mounts. Against the base bundle the split lands almost entirely on ordinary pages: one that uses no Web Awesome widget goes from 0 to 260,702 bytes, while one that does goes from 428,708 bytes in a single file to 436,425 across two. So the cost is on the critical path by construction rather than by need, and if the answer is that it can't wait, the description is the place to say why.
That await also leaves an ordering rule nothing states. Lit resolves updateComplete only once an element connects, so mountNarrowing has to stay above it; moved back to where it was, the search input never connects, the await never settles, and boot stops there — no conversation, no keyboard, no presentation. A line where the mount order changed would keep the next reader from reintroducing that.
Last, a coordination note rather than a finding: #917 rewrites the same RING_CASES entry. It deletes the "a walked thread" case, on the grounds that #905 removed the thread-card ring rule the case named, while this one retargets the case to thread-summary. Whichever lands second will need the other's resolution.
How the readings above were taken
Both label measurements come from getBoundingClientRect().height on the [part~='form-control-label'] node inside each control's shadow root, on a served page in the merged tree: .lf-page-map-search 16.8px, .lf-find-box and .lf-thread-state 1px each. The byte figures are the tracked bundle sizes — webawesome-chrome.js 7,322 plus webawesome/chunk-BSB54GSU.js 253,380 here, against webawesome.esm.js 428,708 at 5c35533 — with the optional entry's 175,723 added for the widget case.
Selected tests run in the merged tree, all green: tests/test_render_conversations.py -k "narrowing or facet or filter or find or refused or panel_settlement" (11), tests/test_render_startup.py tests/test_render_navigation.py -k "page_map or preview or session or global_destinations or narrow" (8), tests/test_render_widgets.py -k webawesome (2), and tests/test_chrome_contracts.py tests/test_render_controls.py whole (112), each with --run-nightly.
…s, banner shelf, and gallery layout (#930) `ci` on `main` is red: the [scheduled complete suite on 4ffc2bd](https://github.com/max-sixty/leaf/actions/runs/35718248873) reported nineteen failures. Fourteen of those node ids, across twelve nightly browser cases, read chrome shapes that three of the morning's merges moved, and this updates those readings. A fifteenth case, which that run did not reach, broke on the merge after it. The remaining five are #917's, already open against #905's native `<details>`; nothing here touches them, so `main` needs both to come back green. No runtime code changes. ## What moved, and what each test reads now **#921 (4ffc2bd) gave the thread panel two selection levels.** Escape from a selected thread now returns to whole-panel selection, and the press after that closes the panel. Nine node ids across four files walked out of Threads in two presses and asserted the panel gone on the second. Each now states the level it gained — `.lf-threads` holds the selection — before the press that closes the panel, which is the shape #921 gave the tests it could see in `test_render_navigation.py`. The intermediate `expect` is also the arrangement: it settles the release before the next Escape rather than firing two presses into one turn. **#918 (a45144d) made the thread lifecycle filters a `wa-radio` group.** Three tests read the standing choice off `aria-pressed`, which a radio does not wear; they now use `to_be_checked()`, the reading the everyday-gate tests #918 updated already use. The same change also made the group exclusive, so re-pressing the standing member no longer widens the list — `test_an_ok_on_the_agents_latest_reply_takes_the_thread_out_of_waiting` pressed "On you" a second time to get every thread back and now chooses the group's open member instead. That second fault was behind the first: the test stops at the `aria-pressed` read, so the run never reached it. **#923 (c6c9cb3) added touch-only selection controls to the banner shelf and renamed the `s` command.** `commentSelection` and `cancelSelection` rank after `threads`, and `select-element` is `alwaysFolded`, so two tests counting the shelf's markup — the last child of `.lf-banner-actions`, the number of children in `.lf-banner-menu` — were reading inventory where they meant what the reader meets. Both now read what stands: the last *visible* control in the row, and, for the door, what is behind it once it is opened. A third read the reference's wording for `target.chooser.open`, a string `test_render_semantic_selection.py` also reads; this reads the reference row by its command id instead, so the words are stated in one place rather than two. Both cases are nightly, so nothing holds that string before `main` either way — #923 updated the one and not the other, which is the whole fault. **#924 (ff34b91) grew the feature gallery between a case's scroll target and its subject.** `test_g_hints_reach_a_late_visible_action_only_location` scrolled to `#bg-quoted-and-visual` and asked for the go-to chip belonging to `#bg-shot`'s margin entry; the new `#bg-live-practice` section sits between the two, so that scroll now leaves the entry about 1,200px below the scrollport and the hint layer is right not to draw a chip for it. The case reached that state because its guard was `to_be_visible`, which says a control is laid out rather than that a reader can see it. It now scrolls to the location's own anchor and reads `to_be_in_viewport`, so the premise it states is the one the hint layer acts on. Checked alone at both commits: green on 4ffc2bd, red on `ff34b919`. ## Why these are updates rather than a fix under them Each failure is a nightly test hand-reading a shape the runtime or the corpus owns, changed by a pull request whose own gate could not reach it: `ci` runs the complete suite on `main` and on the schedule, never on a pull request, because it holds a runner for over an hour on a shared pool — a trade-off `ci.yaml` states, with `main`'s own run and `tend-ci-fix` as the designed repair step. So the level above these tests is working as intended, and the durable improvement available inside them is to read a declaration instead of an incidental shape. Every fault here but the Escape depth moves that way: a radio's checked-ness and its exclusivity, a command id, and — twice — the run that stands rather than the shelf's markup. The Escape-depth nine have nothing more declarative to read — the press count *is* the behaviour — and each states the unwind because the assertion around it is about where focus lands and what stays open, so they keep their own narration. The gallery case is the same move at the arrangement end: it now states the premise the hint layer actually reads, so corpus content growing under it fails loudly rather than quietly changing what the case is about. That leaves the seam #917 named for the thread card exactly as reachable as it found it: the panel's chrome has no single place a change to it can find its readers. ## Verification All fourteen failed in the scheduled run on 4ffc2bd, and each passes on this branch under `uv run pytest --run-nightly -n0` on this CI host. The fifteenth was found by running the six changed files whole: `test_render_aim.py`, `test_render_anchors.py`, `test_render_controls.py`, `test_render_margin.py`, `test_render_navigation.py` and `test_render_reactions.py` are 574 cases under `--run-nightly -n2`, and the only two failures were `test_g_hints_reach_a_late_visible_action_only_location`, now fixed here, and `test_a_thread_at_rest_shows_only_the_marks_that_stand_in_it`, which is #917's. `pre-commit` passes on the changed files. Besides the gallery case above, two cases have their arrangement changed rather than only their assertions, so those three are the ones worth a second look: `test_the_responsive_action_row_keeps_primary_actions_in_reach` opens the overflow door to read what stands behind it and closes it again, because the shelf freezes its partition while the door is open and the test registers another control straight after; and `test_covering_threads_keeps_the_reader_and_their_work_inside` reads the document's scroll position after the thread releases to the panel rather than before, the release being the press that no longer closes the sheet. A pull request runs the everyday gate, which reaches none of these files, so `ci` here says nothing about them; `main`'s own complete suite on the merge is the first run that reads them. --------- Co-authored-by: leaf-agent <[email protected]>
Leaf's banner copy actions and search/filter fields now use Web Awesome. Copying preview diagnostics, layer identity, or a session reference retains the existing labels and visible feedback while Web Awesome owns clipboard handling and announcement. Thread lifecycle filters are a radio group, optional facets are checkboxes, and thread and Page Map search use its input component. Existing keyboard routes and focus restoration remain in place.
The vendor build now emits a core chrome entry and an optional widget entry with shared chunks, so components are registered once. Other Web Awesome widgets still load on demand. This adds two requests and about 263 KB of decoded JavaScript before presentation on the comparison page; it consolidates control behavior at the cost of more startup work. Local median presentation moved from about 379 ms to 446 ms, with no browser exceptions; timings are diagnostic and machine-dependent.
The chrome controls load during boot because restored panels and immediate keyboard gestures use the same synchronous routes as already-open controls. Search shortcuts register on the rendered internal input before keyboard handling starts. Deferring the dependency would require making those opening/focus routes wait for control readiness; this change retains their existing immediate behavior. The default closed-panel view therefore also pays that startup cost. A shared
lf-label-hiddenmodifier keeps compact search and filter labels accessible without duplicating their visible captions, including the existing diff search.Validation covers real clipboard contents, keyboard search and filters, overflow focus, Page Map navigation, narrow layouts, the authored-shadow validation boundary, and matching desktop before/after inspections. All 1,226 everyday tests, 185 chrome/startup tests, 97 conversation tests, 116 render-gate tests, and 33 runtime tests passed, along with focused Page Map/search/theme checks and pre-commit. Browser assertions now follow native radio tab order and Web Awesome's rendered controls.