Repository navigation
Name a playground's controls by the words beside them, so their preview doesn't repeat those words - #6040
Merged
Conversation
…ew doesn't repeat those words Tabbing onto or hovering a playground's range, switch or select showed a preview holding only the control's label, which stands whole beside it. A preview says only what its target doesn't show (browser/AGENTS.md, "A preview says what its target doesn't"), but the playground named each input with `aria-label`, so the preview had no way to know the visible span said the same words. The playground now names each input, select and choice group with `aria-labelledby` pointing at its visible label, and the preview counts a control's `aria-labelledby` elements among its labels, as it already counted its `<label>`s. The label stays a span, since a press on its words selects them and works no control. Behavior changed: focus or a pointer on a playground control whose label shows previews nothing unless a key presses it. A control labelled by visible text through `aria-labelledby` anywhere now previews only what that text doesn't say. Found by the weekly UI sweep on examples/alert-thresholds.
This was referenced Nov 15, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 15, 2026
…n its words names the control (#6043) #6040 gave each playground control's visible label span the id `<playground>-<name>-label`, so that the input could be named with `aria-labelledby`. Anchoring treats any id that doesn't start with `lf-` as an authored target (`ADDRESSABLE` in `browser/runtime/anchor-resolution.js`). So Alt-aiming at a control's label words targeted that generated span instead of the authored `lf-playground-control`, and a comment there would anchor to an id the author never wrote. The span's id now starts with `lf-`, the prefix anchoring already leaves to generated ids, as toc-view's lent section ids and lf-gloss's tips use. `aria-labelledby` follows the new id, so #6040's preview behavior is unchanged. `test_a_comment_names_the_playground_member_it_points_at` failed on main (CI run [43706688461](https://github.com/max-sixty/leaf/actions/runs/43706688461) and locally at `badc6f30a`, with `assert 'word-playground-word-label' == 'word'`) and passes with this change. #6040's own `test_a_control_whose_words_stand_beside_it_previews_nothing` and the playground and preview tests selected by `-k "label or name or preview"` (144 tests) pass too. The exception is the Firefox crash below. This doesn't address the second failure #6040 introduced in the same run: `test_playground_range_preserves_preview_focus_without_cancelling_native_drag[firefox_browser]` crashes Firefox's content process (signal 11). A bisect over `74008ae53..0144d46` lands on #6040, and the crash stops when the range input goes back to `aria-label`. It is tracked separately. Refs #3985 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 15, 2026
…der Playwright 1.65 (#6045) `test_playground_range_preserves_preview_focus_without_cancelling_native_drag[firefox_browser]` has crashed Firefox's content process since #6040. The cause is upstream. Playwright 1.65's role locator reads `element.ariaLabelledByElements` in its isolated world, and Firefox segfaults once the page's own world has read that property too ([microsoft/playwright#43967](microsoft/playwright#43967), [Mozilla bug 2090055](https://bugzilla.mozilla.org/show_bug.cgi?id=2090055)). Playwright has closed its issue as fixed by the next Firefox roll, but every released Playwright up to 1.65.2 still ships `firefox-1572`. #6040 named the playground's range by `aria-labelledby`, so two page-world reads now reach it: - **Leaf's preview.** `labelsOf` and `markupName` in `browser/runtime/preview.js` read `ariaLabelledByElements` when the pointer or focus lands on the control. They now resolve `aria-labelledby` by id in the control's tree, so a Leaf page never reads that property in the page's world. Leaf sets no labelling elements from script, so this finds the same elements and changes no behavior. #6040's preview rule still holds: `test_a_control_whose_words_stand_beside_it_previews_nothing` passes. - **The test's own `dispatch_event`.** On a role locator, `dispatch_event` resolves the accessible name in the page's world, and the surrounding actions resolve it again in Playwright's world. That crashes Firefox with no Leaf code involved. The test now dispatches `pointercancel` through an element handle, which doesn't resolve the name again. Before the change, the Firefox variant crashed in 3 of 3 runs on main. With only one of the two changes it still crashes. With both, it passes 3 of 3 locally, on main after #6043 as well. Both changes cite the upstream issue in a comment, so they can be dropped once Playwright ships the fixed Firefox. <details><summary>Reproduction and checks</summary> With no Leaf code, Playwright 1.65.0 and `firefox-1572` crash on `<span id="l">Max</span><input type="range" aria-labelledby="l">` when `page.evaluate("…ariaLabelledByElements")` and `get_by_role("slider", name="Max").count()` both run, in either order. Either one alone passes, and so does an id lookup followed by the role query. On a Leaf page, hovering the range and then calling `get_by_role(...).count()` crashed before the preview change and passes after it. `role.dispatch_event(...)` followed by `role.count()` crashes whether or not Leaf has read the property. Passed: the three variants of the reproducing test, all of `tests/browser/controls/test_previews.py`, and the playground tests that select labels, take focus or hold a range press (139 tests). `pnpm run check:browser`, `pnpm run test:runtime` (980 passed) and pre-commit on the changed files also passed. </details> Closes #6044 — automated triage Co-authored-by: leaf-agent <[email protected]>
This was referenced Nov 15, 2026
test: update four tests to thread holders, labelledby names, full-measure cards and acked undo
#6046
Merged
leaf-agent
added a commit
that referenced
this pull request
Nov 15, 2026
…sure cards and acked undo (#6046) Four tests in [scheduled run 43706054091](https://github.com/max-sixty/leaf/actions/runs/43706054091) still expect what the page did before a merged change. Each change moved the interface on purpose, and this PR updates the tests to the new behavior. No product code changes. - **`test_an_agent_reply_can_move_a_thread_to_its_revised_visual`, `test_an_agent_reply_can_remove_a_subject_and_detach_its_open_thread`** (both platforms): #5961 added `holder` to each thread record in `page state` and updated the model tests, but not these journeys. They now expect `"holder": {"kind": "main"}`. - **`test_complete_views_restore_native_values_in_wrapped_layouts[1200|390]`** (both platforms): #6040 names a playground control with `aria-labelledby` (the textbox is still named "Title"). The test looked for `input[aria-label="Title"]`, which no longer matches, so it now uses `get_by_role("textbox", name="Title")` like the rest of the test. #6038 moved this test into the journeys tier, so #6040's own CI didn't run it. - **`test_strokes_join_one_drawing_until_it_is_sent_and_escape_leaves`** (both platforms): `git bisect` names #5846 as the first bad commit. That change opens the comment box and the sent thread's card at the full measure. In the test's window, the box (x 382–946) and then the card (x 368–960) cover `#fig`, where the test's strokes began. The press landed on the box's text field, so no second stroke was drawn. The two strokes over the figure now start at its left edge (x ≈ 262–348). They still begin over another element, which is what the test checks. - **`test_resolving_a_thread_from_threads_moves_on_to_the_next`** (macOS only): it pressed `z` as soon as the Resolve was acked, before the page held the server's reading. That's #5941's mechanism, which #5943 fixed in the sibling tests. It now uses `undo(page)`, which waits until the dispatcher would take `z`. **Verification.** On main (`9f3c6590b`), the five Linux-reproducible cases fail before this change and pass after it. The edited modules pass in full, along with `tests/model/test_suite_source.py`: 1,225 passed. The resolve test passes on Linux both before and after. Its macOS evidence is the next scheduled `test-macos` run. This leaves the run's other new failures to their own owners. Those are listed on #4225. Refs #4225 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 17, 2026
A playground's controls are now a native HTML form. The author writes ordinary fields inside `lf-playground`, in an `<aside>` that is the rail: a range or number input, a checkbox with `role="switch"`, a `<fieldset>` of radios, a `<select>`, color and text inputs, `<output for>` for a reading, and the page's own `<button type="submit">` (and `type="reset"`). Everything else in the playground is the preview. The child tags `lf-playground-control`, `-choice`, `-value` and `-preview` go, with `x-within` and keyed `x-refers`, which only the playground used; presets and the agent's task text (`lf-playground-output`, `-preset`, `-setting`) keep their tags, since HTML has no element for either. Leaf reads fields by `name` inside one generated `<form>` around the rail and preview, which scopes each playground's radio groups. `tune` and `choose` record exactly as before; the browser's own value checking replaces Leaf's range, step and colour checks, and numbers reach CSS bare (`calc(var(--playground-radius) * 1px)`). What changes for users: duplicate or unknown control names fail in the browser rather than in `page check`, so a playground posted in a thread message is unchecked; pressing a label's words operates its control, reversing #6040/#6043; `g` no longer reaches playground fields; a quoted playground shows its fields disabled rather than hiding them. Candidate cards draw from the page's own CSS, 20 to 40 lines per example. Max picked this ("score it on the 15 cases, then land it as built") on a survey of places Leaf puts its own layer between authors and HTML. Scored on the 15 playground eval cases against main, Opus 5.5 author and judge: head passed 14 of 15, and `motion-design`, its one failure (a claim about tap playback on the page's own script), passed 2 of 2 on a rerun; base passed 12 of 15, failing three cases whose rubrics are converted to the new markup. Tests: `pnpm run check`, `test:runtime`, the focused model tests, every playground browser test, and 16 other tests that use a playground. Source +501/−895, tests +441/−927. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tabbing onto or hovering a playground's range, switch or select showed a preview that only repeated the label standing beside it. The playground now names each control with
aria-labelledbypointing at that visible label. The preview counts a control'saria-labelledbyelements among its labels, as it already counted<label>s. So these controls now preview nothing unless a key presses them. Found by the weekly UI sweep onexamples/alert-thresholds.Tab onto "Count finance-ops pages in the budget", before and after:
The preview's rule is that it says only what its target doesn't show whole (
browser/AGENTS.md, "A preview says what its target doesn't"). The playground named each input witharia-label, so the preview couldn't tell that the span beside it said the same words. The label stays a span, not a<label>, becausetest_playground_labels_can_be_selected_without_changing_the_controlsrequires that pressing its words selects them and doesn't toggle the control.Behavior changed: focus or a pointer on a playground control whose label shows now previews nothing. This also applies to any control on a page whose name comes from visible text through
aria-labelledby: it previews only what that text doesn't say.Verification
test_a_control_whose_words_stand_beside_it_previews_nothing(tests/browser/controls/test_previews.py) fails if either half is reverted. Revertingpreview.jsshows a preview; revertingplayground-view.jsshows "Page budget".test_a_control_previews_its_word_and_every_key_that_presses_it,test_a_range_and_a_select_preview_their_names_and_a_thread_card_none, and the playground tests that find controls by name or select labels (test_playground_controls_take_focus_from_editors_and_keep_candidate_focus,test_keyboard_can_take_a_range_while_the_preview_preserving_press_is_held,test_playground_select_keeps_the_same_working_configuration,test_a_playground_keeps_one_typed_working_state_until_the_user_chooses,test_playground_labels_can_be_selected_without_changing_the_controls).pnpm run check:browser,pnpm run test:runtimeand pre-commit on the changed files all passed.alert-thresholds, aleaf-dev probejourney showed the range and switch previewing nothing on focus or hover, with no console errors.