Repository navigation
Fix banner control placement - #950
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Three nightly cases in tests/test_render_controls.py fail on this branch and pass on the merge base (5d52c08), run the same way — uv run pytest -n0 on the named node ids. They are not in the PR's uv run pytest tests -q figure because broad discovery skips nightly selection, so the 1280 in the description never reached this file.
The 320px banner now clips Threads off its own right edge. test_the_responsive_action_row_keeps_primary_actions_in_reach reads .lf-threads-toggle at left 205, right 326 in a 320px viewport, and test_the_banner_uses_the_page_mark_and_puts_each_edge_by_its_panel reads the row needing 336px in the 320 it has. .lf-banner-actions states overflow: hidden, so the last 6px of the control — the edge elementFromPoint is asked for — is not there to press. The fold was what absorbed that overflow, and the new padding-inline: 10px on the two primaries spends 8px more per control at exactly the width that has none to spare: it buys one measurement that survives the breakpoint, and pays for it on the narrowest screen the banner supports. Whatever replaces the fold has to leave 320px whole — a narrower reservation below the breakpoint, or Approve giving up its seat where the row cannot hold both.
The versions menu no longer hangs from the chooser. test_the_versions_menu_hangs_from_the_chooser_that_opens_it gets menu.top 48 against button.bottom 108.3. That follows from the two changes meeting: the chooser now stands inside the More popover, which itself starts at --lf-banner-h + 6px, while .lf-version-menu takes that same fixed top — so the nested menu opens level with the popover holding its own invoker and paints over it. The PR routed that test's press through banner_control but left the placement contract it is named for, and that contract is what the reading now contradicts. Either the menu should hang from the More popover's bottom rather than the banner's, or the contract has moved and the test should say what the new one is.
The page-status popover keeps the anchored vertical edge this PR takes off the other two. In skills/leaf/assets/runtime/chrome.css, .lf-status-detail still reads position-anchor: --lf-status; top: calc(anchor(bottom) + 8px) — the shape .lf-banner-menu and .lf-version-menu had before this change, anchored into the same fixed banner. On an iPhone 15 WebKit context, on LONG_PAGE scrolled to the bottom (scrollY 6870, innerHeight 659), the re-anchored More menu lands at y 94 and the status detail at y −6822; Chromium places both correctly at either spelling, so the new 0 <= box["y"] < innerHeight assertions in test_a_menu_comparison_keeps_its_active_paint — a browser test — do not reach it. top: calc(var(--lf-banner-h) + 8px) puts it at y 96 on WebKit and 50 on Chromium, and .lf-banner states height: var(--lf-banner-h), so the two spellings agree wherever anchoring works at all. What left the third instance behind is that the rule this PR found — a top-layer popover anchored into the fixed banner takes its vertical edge from --lf-banner-h, not anchor(bottom) — is applied twice and written down nowhere.
Runs behind the above
Candidate, merge ref 76eac12 (PR head 6327c2f over base 5d52c08):
uv run pytest tests/test_render_controls.py tests/test_render_application_boundary.py -q
6 failed, 103 passed
Control, merge base 5d52c08, same node ids, -n0: test_taking_the_panels_strip_leaves_the_reader_on_the_same_words and both parameters of test_every_control_the_layer_offers_is_a_box_the_reader_can_hit fail there too — those three are pre-existing and not this branch's. The other three pass on base:
test_the_responsive_action_row_keeps_primary_actions_in_reachtest_the_versions_menu_hangs_from_the_chooser_that_opens_ittest_the_banner_uses_the_page_mark_and_puts_each_edge_by_its_panel
Green here: tests/test_chrome_contracts.py (21 passed) and npm run test:runtime (34 passed).
The WebKit reading came from a temporary case on the merge ref that opened LONG_PAGE, scrolled to document.documentElement.scrollHeight, opened each popover and read bounding_box():
| popover | WebKit y |
Chromium y |
|---|---|---|
.lf-banner-menu (re-anchored here) |
94 | 48 |
.lf-status-detail (unchanged) |
−6822 | 40.5 |
.lf-status-detail with --lf-banner-h |
96 | 50 |
leaf-agent
left a comment
There was a problem hiding this comment.
Opening Versions from More now paints the versions menu over the More panel holding its own invoker. With More open, the menu takes the same banner-relative top as that panel, so it lands on top of it and covers the rows at the panel's head. On Chromium it covers the Versions chooser itself: at 1200px the More panel reads top 48, bottom 113.3, the .lf-version chooser inside it 78 – 108.3, the menu 48 – 98, and elementFromPoint at the chooser's centre returns lf-version-menu. At 390px it is panel 94 – 159.3, chooser 124 – 154.3, menu 94 – 144. On WebKit the panel is taller, so the menu clears the chooser but still covers the panel's first rows: scrolled to the bottom of LONG_PAGE, panel 94 – 238, menu 94 – 150. This is the pointer half of the journey the description lists as walked ("scrolled More → Versions"). The keyboard route is fine — with More closed the chooser is not visible, the anchor falls back to the More door in the banner, and a banner-relative top is then the right answer.
The shared rule is where the distinction was lost. :is(.lf-banner-menu, .lf-version-menu, .lf-status-detail) states one vertical edge for "a top-layer panel owned by the fixed banner", but the versions menu's door is not in the banner — it is inside another panel, at a height --lf-banner-h does not describe. version-chooser.js already carries the condition that separates the two cases, and applies it to the other axis: this.menu.style.positionAnchor = this.button.checkVisibility() ? "--lf-version-btn" : "--lf-banner-more". After this commit the horizontal edge follows whichever door actually opened the menu while the vertical edge is a constant that cannot, so on the pointer route the two axes resolve against different elements.
The assertion that named this was removed rather than satisfied. test_the_versions_menu_hangs_from_the_chooser_that_opens_it held menu.top >= button.bottom under the message "the versions menu covered the chooser it hangs from". The replacement asserts menu.top ≈ banner.bottom + 6 and opens More through banner_control before measuring, so it now certifies the overlap as the contract. tests/CLAUDE.md, "Make a green test non-vacuous", names this shape: "Bounds and geometry tests are especially prone to staying green after the fault moves to another edge."
Restoring anchor(bottom) on the chooser is not the way back — I measured it, and it reintroduces the WebKit fault this commit exists to fix (menu top −6631 on the scrolled page above). What holds on both engines is taking the vertical edge from the panel that holds the door rather than from the banner: with an anchor-name on .lf-banner-menu and the versions menu reading anchor(bottom) from it, WebKit places the menu at 244 against a panel bottom of 238, and Chromium at 119.3 against 113.3. That leaves the closed-More case to the existing banner constant, which the same checkVisibility() condition already selects.
Measurements behind the above
Candidate 6548f33c, merge base 559debbe. Each row opens the versions menu and reads getBoundingClientRect() on the More panel, the chooser, and the menu. WebKit rows are the iphone fixture on LONG_PAGE scrolled to scrollY 6870; Chromium rows are the browser fixture.
| route | engine | More panel | .lf-version |
.lf-version-menu |
|---|---|---|---|---|
| More → Versions, 1200px | Chromium | 48 – 113.3 | 78 – 108.3 | 48 – 98 |
| More → Versions, 390px | Chromium | 94 – 159.3 | 124 – 154.3 | 94 – 144 |
| More → Versions, scrolled | WebKit | 94 – 238 | 189 – 233 | 94 – 150 |
g Shift+V, 1200px |
Chromium | closed | not rendered | 48 – 98 |
On the merge base the same probe at 1200px put the chooser on the banner row with its menu at top 41.6 below it, and elementFromPoint at the chooser's centre returned lf-btn lf-version.
Two spellings tried for the versions menu's vertical edge, same scrolled WebKit arrangement:
| spelling | WebKit menu.top |
Chromium menu.top |
|---|---|---|
anchor(bottom) from --lf-version-btn |
−6631 | 114.3 (panel bottom 113.3) |
anchor(bottom) from an anchor-name on .lf-banner-menu |
244 (panel bottom 238) | 119.3 (panel bottom 113.3) |
Green on this head, run -n0: the three nightly cases from the previous review — test_the_responsive_action_row_keeps_primary_actions_in_reach, test_the_banner_uses_the_page_mark_and_puts_each_edge_by_its_panel, and the renamed versions case — plus test_banner_status_is_compact_with_accessible_details. That last one is not vacuous: reverting .lf-status-detail to the base anchored spelling fails it on Chromium at 40.5 vs 50 ± 2. The --lf-status anchor-name is removed with no reference left behind, and the padding-inline move holds that value at 6px in both breakpoints, which is the invariance the deleted comment asked for.
Separately, on the two commits since: .lf-chrome is the right set — chromeRoot carries that class and overflowMenu and versionMenu are its children, so the test now reaches the controls the popovers hold. Both sites spell it by hand, though, and surface.js already imports the reading: inChrome comes in on line 92 from ../passages.js and the file calls it a hundred lines further down. inChrome resolves across shadow boundaries, which the raw closest does not, and it is the same value the page/chrome split elsewhere is built on — worth calling rather than keeping a third spelling of the question in the file.
|
The remaining overlap is the intended shared fixed-banner panel contract, not a lost route. More remains reachable, native Escape closes Versions and restores its parent menu, and the direct pointer and keyboard journeys retain focus and clickable rows. Positioning the child below a dynamically tall More panel introduces a real short-viewport failure: the child max-height and trailing rows would need another geometry/fallback mechanism, recreating the adaptive complexity this change removes. The follow-up head
|
|
Both answered. The placement argument holds: anchoring the versions menu to the More panel's bottom hangs it off a box whose height is content-dependent, and a short viewport then needs the max-height and fallback machinery this change exists to remove — the renamed case states the contract that replaces it. That reasoning is worth a clause in the shared rule's comment in One thing about the added |
leaf-agent
left a comment
There was a problem hiding this comment.
The nightly selection is red on this branch. Eleven cases across three test_render_* files fail on the merge ref and pass on the merge base 559debbe, run the same way — -n0, same node ids. Nothing on this PR reaches them: ci.yaml's nightly job carries github.event_name != 'pull_request' and reports skipping on this head, and broad discovery skips nightly selection, so the uv run pytest tests -q figure in the description did not touch these files either. The first run of them is main's own, after the merge, where the red run goes to ci-fix.
The banner reseating is the common factor, and it does not land in one shape. Two I traced:
A press or read left on the row's old seat. test_the_version_menu_is_worked_by_pointer_and_key opens its pointer half with btn.click() on page.locator(".lf-version"), which now waits 30s on a control inside a closed popover. test_selection_banner_controls_follow_the_primary_pointer reads Cancel selecting an element by role with More closed, where it is not in the accessibility tree at all. The sibling case in that same file was carried across — test_touch_reader_selects_an_element_comments_and_finds_its_thread reaches both controls through banner_control(page, ".lf-banner-menu .lf-btn:text-is('Cancel selection')") — so the sweep reached some call sites and not the rest.
A case the sweep already converted, failing on the press the conversion adds. test_closing_a_tray_places_the_margin_against_the_released_column arms a {once: true} document click listener to catch the press that closes the Asks tray, then calls banner_control(page, ".lf-asks").click(). banner_control presses the More door first, that click bubbles to the document, and the listener spends itself on it — so the margin is read with the panel still open: 1246.5 against the 1096.5 ± 1 the released column wants. tests/CLAUDE.md names the shape under A test cannot assert over noise it makes itself. The helper now makes a press of its own, so converting a call site is not always a substitution.
One thing worth holding while the first shape is repaired: under fixed menu seats a closed More satisfies a to_be_hidden read whatever the control's own presence is, so the two such reads on cancel in test_selection_banner_controls_follow_the_primary_pointer would stop testing the retirement that case is named for. Its select reads on either side already open More first and stay meaningful.
Happy to push the repair if you want it, though at eleven cases you may prefer to take it in the branch.
Runs behind this
Merge ref e072f526 (head 34d13519 over main f4107f63), the five files the banner sweep touched:
uv run pytest -q -n4 tests/test_render_semantic_selection.py tests/test_render_aim.py \
tests/test_render_anchors.py tests/test_render_navigation.py tests/test_render_margin.py
16 failed, 476 passed in 819.39s
Those sixteen node ids re-run -n0 on the merge ref: 15 failed, 1 passed — test_generated_hints_follow_the_page_while_it_moves passes alone and was the parallel run's own noise. The same sixteen on the merge base 559debbe, -n0: 4 failed, 12 passed. The four that fail on base as well are pre-existing and not this branch's:
test_render_anchors.py::test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline[light]and[dark]test_render_navigation.py::test_inner_state_is_left_before_the_surface_around_ittest_render_navigation.py::test_a_comments_quoted_passage_is_in_the_keyboard_journey
The eleven this branch owns, with what each failed on:
anchors::test_the_version_menu_is_worked_by_pointer_and_key Locator.click timeout 30000ms
anchors::test_the_current_page_has_a_menu_local_key expected to be visible
margin::test_a_held_marker_hands_the_reader_to_the_page_map_when_the_rail_falls
expected to be focused
margin::test_the_small_screen_map_is_a_complete_accessible_sheet[keyboard]
expected to be visible
margin::test_the_small_screen_map_is_a_complete_accessible_sheet[pointer]
expected to be visible
margin::test_crossing_to_the_small_screen_retires_the_desktop_preview
expected to be visible
margin::test_closing_a_tray_places_the_margin_against_the_released_column
1246.5 == 1096.5 ± 1
navigation::test_the_g_chord_reaches_the_all_leaves_panel expected attribute 'g L'
navigation::test_banner_destinations_use_transient_target_overlays expected to be visible
navigation::test_the_ring_holds_on_a_seat_the_agent_has_still_to_answer
Locator.click timeout 30000ms
semantic_selection::test_selection_banner_controls_follow_the_primary_pointer
expected to be visible
This is the files the sweep touched, not the whole nightly selection — test_render_controls.py, test_render_widgets.py, test_render_projection.py, test_render_gate.py, test_render_pages.py, test_render_conversations.py and test_site.py were not in it. A ci dispatch on this branch holds a nightly slot of its own and would give the complete answer.
leaf-agent
left a comment
There was a problem hiding this comment.
The deleted toggle assertion is a lost pointer route, not a test-sweep casualty. test_the_version_menu_is_worked_by_pointer_and_key dropped "A second press is a close, not a re-open: without that the outside-click handler and the toggle would both run and the menu could never stand." I tried to restore it through banner_control and could not: on the three-version fixture the case builds, the chooser occupies 138.6 – 168.9 and its own menu 48 – 178, so elementFromPoint at the chooser's centre returns .lf-version-row, and Playwright refuses the press with data-lf-version="1" intercepting. The invoker is not merely painted over — a reader who presses where the chooser is, to shut the menu the way they opened it, lands on row v1 and navigates. That is the one reading in your reply I can't reproduce: "the direct pointer and keyboard journeys retain focus and clickable rows" holds for the rows, but the chooser is not clickable while its menu stands, and what is clickable in its seat does something else. Either the placement keeps the invoker reachable, or the case says the new contract out loud — deleting the assertion leaves the route unstated and unpinned.
Three more assertions go that the re-seating did leave intact. Each still passes on this head under the arrangement the commit replaced — I ran them, and the inline suggestions restore them.
test_a_prose_revision_takes_only_the_words_it_rewrote gave up two. Its press was chip.evaluate("el => el.click()") precisely because a synthetic press moves no focus and dismisses nothing, which is what made focused: document.activeElement === window.__prFocus a reading of the revision rather than of the gesture; the composer read beside it was the box the reader had open over their passage surviving the new document. .lf-latest-chip is display: none inside a shut popover and HTMLElement.click() does not care: on this head the original body still returns {'selection': 'account', 'sameNode': True, 'sameElement': True, 'focused': True} with activeElement still #pr-control, and .lf-composer still visible reading “account”Suggest replacement text. Converting that press to banner_control substituted a real pointer press, which takes the focus and closes the composer, so both assertions had to go and the docstring now says focus follows the route instead. CLAUDE.md's Cross-runtime invariants is what they were holding: focus "lives exactly as long as the node holding it … whatever replaces a node hands it across itself, under the identity that replacement already keys on, or the reader loses it." This was the only case pinning that on a reader-pressed adoption; the two reads left in the file, on #lk-one .lf-pick and #wd-keep .lf-pick, are both auto-adopt.
The third is smaller. test_selection_banner_controls_follow_the_primary_pointer dropped the tail that reopened More and read select hidden once the fine pointer was back, so only cancel still straddles a presence→absence transition and the case's plural name rests on one control. Beside it, test_the_g_chord_reaches_the_all_leaves_panel kept its live_leaf("third") / round_trip(page) setup but deleted both readings it fed, so the detached overlay surviving a routine poll is now asserted for no control — test_banner_destinations_use_transient_target_overlays never polls.
What these share is one rule applied uniformly: banner_control(…).click() as the substitution for every .click() on a re-seated control. That is right wherever the assertion needs the control visible, which is most of what this commit converts. It is wrong where the press arrangement was itself the assertion's control — a synthetic press chosen to move no focus, a reopen chosen to straddle a retirement — and where the conversion does not merely change the gesture but cannot express the reading at all, as with the chooser above. The first case is a conversion to undo; the second is the product telling you something through the test.
Separately, the to_be_visible() → to_have_class("lf-news-shown") conversions read back a value banner-shelf.js states is not one: "These are paint only. The owner's entry is the value read by layout and door decisions; neither class nor style is read back as authority." The class is entry.conditional && entry.offered; the display decision is entry.present && (!entry.conditional || entry.offered). No control uses both showNews and showBannerControl today, so the two agree — but the suite now has roughly twenty-five sites that go quietly vacuous the first time one does. The shelf is the only thing that can answer "is this control offered to the reader"; a reading exported beside bannerControlDoor, with one harness helper over it, would say what these assertions mean and would not move when paint does.
Runs behind this
Merge ref a3204925 (head 55aa4f55 over base f8660f72).
The commit's own selection, -n4 — the 39 changed cases across test_render_anchors, test_render_drafts, test_render_gate, test_render_margin, test_render_navigation, test_render_options, test_render_outbox, test_render_projection, test_render_semantic_selection, test_render_startup and test_render_widgets, 41 node ids with parameters: 41 passed in 80.13s. The eleven nightly cases the previous review named are answered.
The chooser probe, on the case's own fixture (INLINE_PAGE pinned to v2 with v2 and v3 published), Chromium at the default width, versions menu open through More:
{'chooser': [138.59375, 168.890625], 'menu': [48, 178], 'atChooserCentre': 'lf-version-row'}
Locator.click: Timeout 3000ms exceeded.
<button role="menuitem" data-lf-version="1" data-lf-revision="1" class="lf-version-row">…</button>
from <div role="menu" popover="auto" id="lf-versions" …> subtree intercepts pointer events
A one-row menu is too short to reach the chooser, so the same double press passes on a single-version page. The row count is what has to be varied for the overlap to show as a route rather than as a fixture-shaped flake.
The two restorable assertions, re-run on this head as temporary cases:
| deleted from | arrangement | reading |
|---|---|---|
test_a_prose_revision_… |
chip.evaluate("el => el.click()") after window.__prFocus = document.activeElement |
focused: True, activeElement #pr-control |
test_a_prose_revision_… |
the same press | .lf-composer visible, '“account”Suggest replacement text' |
Both inline suggestions applied together: test_a_prose_revision_takes_only_the_words_it_rewrote passes.
One thing that reads the other way, so the suggestion is not misread as a regression report: on the base f8660f72, with the chip on the banner row, a real chip.click() also closes the composer and lands focus on .lf-version. Losing the composer is what a pointer press has always done. It is the synthetic arrangement, not the seat, that those two assertions depended on.
|
The exact-head findings are addressed in
Focused replacement routes, the affected assertion selection, runtime tests, and pre-commit are green. The full Anchors + Controls run passed 186 cases; its four failures are the already controlled diff-lifecycle and panel-scroll baselines, while the stale hidden Versions caller it exposed was cut over and rerun green.
|
|
Confirmed on merge ref The overlap is gone, and it holds on WebKit. WebKit is where the original anchoring fault lived, so I drove the replacement route there directly rather than reading it off the Chromium case. On an iPhone 15 context the banner's bottom is 88 and the versions menu opens at top 94 with The eleven nightly cases are green. On that merge ref, On the prose-revision assertions, the focus argument holds. A reader press puts focus on the control it presses, so there is nothing for the replacement to carry across, and the auto-adopt reads in that file are where that invariant actually lives. One control the replacement did not reach: Latest. Pressing That last part is The rule it misses is stated in its callers rather than in the shelf. The complete nightly answer is still running. A pull request never reaches the nightly selection and the last two commits changed thirteen test files, so I dispatched Runs behind thisMerge ref The WebKit journey, run as a scratch case on the same ref against the
The Latest reading is the |
|
The dispatched suite finished, and nothing in it is attributable to this branch. Six of the eight are in both sets: The seventh is the dispatch's own blind spot rather than a result, and worth naming because a dispatch against a branch head reads this way every time. The branch's merge base is That leaves
|
…some fields at 16px (#979) #950 moved every control except Approval and Threads behind More. Two of those controls only exist during a reader's gesture: "Comment on selection" after a touch selection, and "Cancel selection" while the target chooser is open. On an iPhone, selecting words turned "Comment on selection" on inside a closed popover that showed no marker, so the #923 flow described in the feature gallery ("tap Comment on selection in the banner") took two taps on a door nothing pointed to. The tests missed it because `banner_control` opens More without saying so. ## Banner shelf: a `gesture` seat The shelf split controls between a fixed row and a fixed menu. It had nowhere to put an action that a gesture produces and that lasts only as long as the gesture. It now has three seats: - `row`: Approval and Threads, the page's reading loop. - `menu`: every secondary action, behind More. - `gesture`: the next step of something the reader is doing right now. While one is on offer it takes the reading loop's place on the row, and the loop comes back when the gesture ends. The swap is a fixed rule rather than a response to width, so the 320px row (zero slack since #974) never has to hold both. If focus was on a loop control when a step displaces it, focus moves to the step. "Comment on selection" is now `primary`, so it reads as the thing to press. Both gesture steps are coarse-pointer only, so nothing changes with a mouse. ## Web Awesome fields meet the 16px phone floor On a coarse pointer, the layer's own fields compute 16px (`--entry-floor`, `shadow.css`). The Threads find box and the Map search are `wa-input`s, and their native field sits in a vendor shadow root that rule cannot reach, so they computed 14px and iOS zoomed in on focus. The theme bridge (`scripts/vendor-src/webawesome/leaf-theme.css`) now sets the vendor's value size to `max(var(--entry-floor), 1em)`. That covers `wa-input`, `wa-textarea`, and `wa-number-input`, including the ones in the widget packages. The bundle is regenerated with `scripts/vendor.py webawesome`. On desktop the floor is 0, so the value resolves to `1em`, which matches what the unset token inherited before. ## Lit duplication: left as is After boot, `window.litElementVersions` is `['4.2.2','4.2.2']`, because `browser-runtime.js` and the Web Awesome bundle each bundle their own Lit. Sharing one copy would mean pointing Web Awesome's imports (`lit`, `lit/decorators.js`, and about eight directive subpaths) at a re-export surface in `browser-runtime.js`. That would tie two independent builds to one export list, which is more than a small build change. `skills/leaf/assets/CLAUDE.md` now says the page runs two copies instead of claiming Lit ships once. ## Tests - The phone comment tests in `test_chrome_contracts.py` and `test_render_aim.py`, and the touch Cancel test in `test_render_semantic_selection.py`, read the step from `.lf-banner-actions` with More shut. They no longer go through `banner_control`. The iPhone test also checks that Threads gives way to the step and that the step fits in the viewport. - `test_a_phone_comment_field_keeps_its_passage_clear` now walks shadow roots, so it reads the vendored fields as well, and it requires at least one `wa-input`. Against the old bundle it fails with `14 >= 16`. - Focused runs pass: phone and selection cases in `test_chrome_contracts.py`, `test_render_semantic_selection.py`, `test_render_aim.py`, and `test_render_controls.py` (26), plus the Web Awesome, targeting, and playground widget cases (18). `npm run test:runtime`: 55 passed. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Summary
Validation
uv run pytest tests -q— 1280 passednpm run test:runtime— 34 passedpre-commit run --all-files— passedg Shift+V, touch Comment/Cancel, focus restoration, and right-edge hit targets