Skip to content

Let a page's header, nav and footer stand beside main - #5228

Merged
max-sixty merged 17 commits into
mainfrom
page-beside-main
Nov 3, 2026
Merged

max-sixty merged 17 commits into
mainfrom
page-beside-main

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

A page can now put its header, navigation, footer or any other content directly in body, beside main, as an ordinary website does. Comments, element selection, revisions and version comparison cover all of it, and a <header> or <footer> beside main keeps its banner or contentinfo landmark. main stays the box a Layout arranges.

Closes #4576

Why main was the whole page, and what replaces it

page check refused anything outside main (outside-main) because main did a job for Leaf: it was a stacking context at z-index 0, which kept every page box beneath Leaf's panel, cards and marks. Once the page reaches past main, something else has to keep Leaf on top.

Leaf's interface root (div.lf-chrome) now stands after body, as html's last child, at the largest z-index (base.css, :root > .lf-chrome). A page box can at most tie with it, and a tie paints in tree order, where nothing the page writes follows it. A dialog or popover the page opens still opens in the top layer above Leaf, as before. main is no longer a stacking context, so how a page stacks and blends its own boxes is the page's.

An earlier version of this branch put Leaf's interface in the top layer as a popover. Review found eight ways that broke pages: a page closing its own popovers hid Leaf, the page's popover styles restyled it, Leaf took the first Tab stops, Escape stopped marking what changed since the last visit, and others. Stacking after body avoids all of them.

The page boundary

  • Browser (browser/runtime/passages.js): pageDocument() returns body, and inPage / leafSurface exclude Leaf's own elements (.lf-chrome, [data-lf-runtime]). Text reading, id lookup, page parts, version capture, revision patching and the render checks read through that boundary. authoredScope (package API) returns body for page nodes.
  • Python: the outside-main finding and its tracking are deleted (structure.py, findings.py, validation/markup.py); main-count still requires one direct main. Script patch regions are head and body, and kernel marks such as x-space apply to any block in body other than main.
  • Revisions: body's own attributes now go through the ordinary patch. restyle (dom-children.js) writes the runtime's carried inline declarations and then the author's text in one write, because setting properties one at a time dropped var() shorthands, whose longhands the CSSOM reads back empty.
  • Inheritance: the chrome inherits from html rather than body, so what the page and the chrome share moved to :root: overflow-wrap, and --lf-ground (and the reading theme's).

Consumers fixed with it

A review of every consumer of the two moves found these, each reproduced and checked after its fix:

  • Anchored chrome: the positioned chrome root is the containing block of an absolute box, which an anchor outside it can't place, so Copy, heading links and a recording's bar stood off screen. Document controls are now fixed, as a control in a cut frame already was.
  • Things scoped to body: the render gate's chrome-words walk, a live sample's startup inert (now on html), and Design mode's cursor rule for marks in the chrome.
  • Things that read only main: margin pins seat against the whole page's words; a dial in a thread message governs its message; dev readers of page text and the corpus.
  • Layouts: a footer beside a Workspace main keeps the body's foot room so it scrolls clear of the panel; Leaf's head room is the body's padding-top rather than a body::before box, which became the first item of a body grid.
  • Older causes the new shapes make common: change bars stay inside the window, and the thread and change walks no longer start from a fixed site header.

What changes for an author

  • Styles and tokens on html/:root reach Leaf's interface as well as the page; ones on body now reach only the page. Leaf's guidance already puts tokens on :root.
  • A page script that appends its own element after Leaf's root, at the same largest z-index, draws over Leaf.
  • body.requestFullscreen() leaves Leaf out of the fullscreen view; the usual call on the document keeps it.
  • A Workspace Layout fills the window, so a header beside main pushes the workspace's foot below it; fitting that is left to the page's CSS. A page of parts holds its title and list fixed at the window's top, so it takes nothing beside main; page-layout.md says both.

Testing

  • Twenty-nine interface states captured on main and on the branch match pixel for pixel (leaf-dev stills), and a page loads the same 35 requests before it first shows, 1.3 KB more.
  • The eight popover-era breakages are each checked in Chromium and Firefox; Leaf staying above a page box at the largest z-index, inside main or beside it, is also checked in WebKit.
  • New tests: content beside main passes page check and reads as passages (test_interact_document.py); a revision writes the author's inline style and keeps the runtime's, including a var() shorthand (test_revision_patches.py, dom-children.test.mjs); a page dialog or popover opened before Leaf loads stays above it (test_presentation.py); passage boundaries exclude Leaf's surfaces (passage-boundaries.test.mjs).

This was written by Claude Code on behalf of max-sixty

Read authored body content through one runtime exclusion boundary for passages,
identity, revisions, comparison and carry. Keep main as the semantic Layout box,
remove outside-main validation and update the authoring contract.

Open a permanent chrome popover before authored body content. Prepaint begins
native layer ordering and the runtime adopts it without reopening or moving it;
this preserves author surfaces opened during startup. Manual popovers no longer
suppress the page's Escape step. Chrome precedes authored body children, with the
corresponding first-child selector and native Tab-order tradeoff.

Retain drafts across body-attribute revisions while still deferring removal of
an authored ancestor that holds an editor. Treat document-shell padding as
viewport spacing in frame diagnostics, preserving ordinary paragraph margins;
a border or explicit declaration still makes the shell a frame.

Validate sibling revisions and landmarks, script moves, native layer ordering,
startup surfaces, version marks and focus retention with focused model/browser
tests, the runtime suite, and browser build checks.
Carry authored-body capture, revisions and page membership onto main’s strict types and SourcePairs. Preserve main’s clipping and native-content observation changes while keeping native-layer opening order in prepaint. Rebuild the kernel.

Validated build:browser, check:browser, 738 runtime tests, 87 focused Python cases, 30 focused browser cases, and pre-commit checks.
The candidate kept the page's content boundary at body and lifted the chrome into a
permanent manual popover at body's start. That root sat in both places readers look:
in `body`, so every page reader had to subtract it, and in the native-layer list, so
every reader of "what stands over the page" did too. The readers it missed broke:
Escape no longer stopped marking changes (change-walk.js), a press into the panel no
longer folded an unfolded pin (margin-projection.js), Escape in a page's own manual
popover dropped focus, a page's `[popover]:popover-open` rule restyled the chrome and
detached the fixed panel, a page script closing every open popover removed Leaf, and
Leaf's controls took the first Tab stops ahead of the page's.

The chrome's root now follows `body` as html's last child: an empty box at the origin
with the largest z-index. A page box can at most tie with it, and the tie paints in
tree order, where nothing in body follows it; the page still rises over Leaf through
the top layer whenever it opens one. Nothing native is opened for Leaf, so delivery
emits no root or opener, prepaint no longer tracks layer order, and the layer stack,
keyboard dispatch, chip planes and geometry return to main's code. `stackLevel` reads a
chrome box above every page level, its rung among Leaf's own, so a page header at
z-index 9999 stays beneath the panel there too.

Outside body, the chrome's elements no longer stood for arrivals, which watched body
alone: widgets in thread messages would not connect and the transcript's scroll slot
went unmarked. Arrivals now watch the document, and a resize rereads every scroll
surface. The design legend's tag visibility is set on html, where the chrome inherits
it, and the root states the wrapping and ground it took from body. Startup transition
suppression reaches it as body's sibling.

A revision that changes body's inline style no longer wipes the properties the runtime
writes there: the patch moves inline declarations by name, as it moves class tokens,
for every authored element.

Tests: the sibling revision test now checks that the page's first control takes the
first Tab stop; the stacking contract test reads `stackLevel` against an overlay beside
main; a new runtime test keeps a runtime property through an authored style change;
the key-scope test returns to main's single-layer reading.
…on the root

Three regressions the re-review of the chrome-after-body arrangement found.

A revision that changed an inline shorthand written with `var()` never
reached the open page: restyle moved the author's declarations longhand by
longhand, and a `var()` shorthand's longhands read back as "", which
`setProperty` ignores (confirmed in Chromium and Firefox). It now writes the
author's new text as given and carries over each property the old text
didn't declare, which are the runtime's. The root-attributes revision test
adds a `var()` outline and fails on the previous restyle.

The chrome inherits from the root, so the reading theme's ground on `body`
no longer reached it, and the chrome root's own copy painted paper on a page
with no theme where `body` had given Canvas. `--lf-ground` and
`overflow-wrap` now have one home on `:root`, in the base and the reading
theme, which `body` and the chrome both inherit; the chrome root's copies are
gone, and package-themes.md says the root supplies the ground.

The held-keys notice stood in `body` at a ladder z-index, beneath the chrome
root and any page box above 9030. It now stands after the chrome root at the
same largest z-index, so the tie paints it over the page and the panel's row,
and leaf.js mounts the chrome right after `body` so a notice already showing
stays after it. The ladder's held-keys rung is gone.
The re-review of e0f009d found three cases its restyle still got wrong,
each run in Chromium and Firefox:

- A property the author newly declared lost to a value a page script had
  already written inline, since only names the old text declared were left
  behind; the script's green stayed where the author now wrote blue.
- A `var()` shorthand a page script wrote was dropped by any revision of that
  element's style, since its longhands read back as "" and were re-set one
  by one.
- An author removing the style attribute left `style=""`.

restyle now writes the author's new text followed by the live declarations
neither the old nor the new text declares, serialized as text, which keeps a
`var()` shorthand whole, and removes the attribute when nothing is left. A
revision makes one style write instead of one per carried property. The
runtime test adds the first and third cases and the root-attributes browser
test the second; each fails on the previous restyle.
# Conflicts:
#	dist/kernel/kernel.json
The re-review of 7d0d4a2 found two cases the author-first join got wrong,
each run in Chrome and Firefox:

- An author's text ending in an unclosed construct, such as `calc(100px +
  20px` or an open quote, no longer closed at the end of the attribute once
  carried declarations followed it, so its value and every carried property
  were lost.
- A script's `margin-left` beat the author's newly declared
  `margin-inline-start`, since the names differ and the carried text came
  last.

restyle now writes the carried declarations first and the author's text
last, where it ends the attribute as it would alone. The root-attributes
browser test ends its revision with an unclosed `calc(`, and fails on the
previous order.
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-content-layout.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-geometry.js
#	dist/kernel/runtime/bundle-page-inspection.js
#	dist/kernel/runtime/bundle-passages.js
#	dist/kernel/runtime/bundle-portable.js
#	dist/kernel/runtime/check-api.js
#	dist/kernel/runtime/geometry.js
#	dist/kernel/runtime/passages.js
#	packages/default/widgets/toc-view.js
# Conflicts:
#	browser/base.css
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-content-layout.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-passages.js
#	dist/kernel/runtime/bundle-portable.js
#	dist/kernel/runtime/check-api.js
#	src/leaf/render-checks/layout.js
Main's dependency rules now hold keyboard/dispatch.js to an exact closure,
and dispatch reaches geometry.js through user-place.js. stackLevel imported
chromeRoot from chrome.js, which put chrome.js in that closure and failed
dependency-cruiser. It now recognises the root by `:root > .lf-chrome`, the
selector base.css stacks it by, as inChrome reads `.lf-chrome`, and
geometry.js imports nothing from the chrome.
# Conflicts:
#	dist/kernel/kernel.json
# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
…ream

A review of every consumer of the two moves found these, each reproduced
before the fix and checked after it:

- Copy on code blocks, heading links and a recording's play bar stood at
  (-10000, -10000) on every page. The chrome's root is now positioned, so it
  is the containing block of an absolute control, which an anchor outside it
  cannot place. Document controls are fixed, as a control in a cut frame
  already was (integration.css).
- The render gate's chrome-words check stopped reading widgets in thread
  messages, which now stand after body; it walks the whole document, and the
  clipped-control walk stops at the root for chrome controls.
- A live sample's chrome escaped the startup `inert` delivered on its body; the
  root carries it now, and the unused body_attributes delivery goes.
- In Design mode the arrow cursor rule missed marks in the chrome; it reads the
  body's stamps as a sibling's, as the presentation hold already does.
- A footer beside a Workspace `main` ended under the panel with no way to
  scroll it clear, since the Layout zeroed the body's foot room. The body keeps
  it when authored content follows `main`.
- Margin pins on content beside `main` covered its words and links, since the
  seating read only `main`'s words; it reads the page's.
- A dial in a thread message did nothing; it governs that message's markup.
- Leaf's head room was a `body::before` box, which became the first item of a
  page that lays its body out as a grid of header, nav and main. It is the
  body's padding-top, beside the foot room's padding-bottom.
- Change bars for blocks at the window's edge stood off screen; they stay
  inside the window. The thread and change walks started from a fixed site
  header; `readingBlock` skips stuck boxes, as the reading-place restore did.
- The clipboard fallback's field, the region capture's exclusions and the
  held-keys notice before body is parsed each now treat Leaf's own elements as
  Leaf's.

The authoring references say what content beside `main` takes (no Layout, and
nothing beside a page of parts), that the page's title stays in `main`, how to
keep landings clear of a fixed site header, and how to go full screen. The
glossary names the page; the corpus refuses a tab whose content stands beside
`main` rather than dropping it; dev readers of a page's text read body. The
control-face test expects the selector the branch already ships.
# Conflicts:
#	browser/runtime/obligations/place.js
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-content-layout.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-errors.js
#	dist/kernel/runtime/bundle-passages.js
#	dist/kernel/runtime/bundle-portable.js
#	dist/kernel/runtime/passages.js
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
…s they were

Review of the downstream fixes found three of them overreached:

- `readingBlock` skipped every stuck block, so on a page whose content scrolls
  inside a fixed app shell every block read as stuck and walks started from
  the page's first item. Where every block on screen is stuck, the first one
  stands again, as before.
- A closed `<dialog>` or a popover after a Workspace `main` counted as content
  that ends the page and gave the body the foot's room, so the workspace
  scrolled by the panel's height. Neither takes room in the flow.
- The region capture hid everything Leaf keeps in the body, threads drawn
  inline included, where main's photo showed them. Leaf's chrome no longer
  stands in the body the capture draws from, so it needs no exclusions.
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
The sample delivery now marks `html` inert rather than `body`, so Leaf's chrome
after the body is inert too until the sample presents; the server test reads
the attribute where it now stands.
@max-sixty
max-sixty merged commit 1f4fdea into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the page-beside-main branch November 3, 2026 21:40
max-sixty added a commit that referenced this pull request Nov 5, 2026
… focusInPage one home (#5425)

A key pressed with focus on the body, which is where focus stands after
a click on words or a wheel, no longer records a place for the page.
That place outranked the one the reader made in a pane, so a window
narrowed afterwards left them at the top of the page rather than on the
paragraph they had read. Recording it on every keydown also cost 303.8
ms per key on a workspace of 801 panes.

Refs #4062. That issue's fresh-load gap, where the keys move nothing
before the user acts in any pane, stays open here; choosing a pane for
the user is proposed separately in #5456.

## Cause

#5228 widened `pageDocument()` from `main` to `body`, so
`inPage(document.body)` became true. The browser gives the body focus
whenever focus stands on nothing. Three readers asked whether focus
stands in the page, and each then answered yes. #5468 fixed two of them,
`userReadingRegion` and `pageReadingRegion`, with a local `focusInPage`
in `reading-regions.js`, and fixed
`test_motion_preference_changes_are_heard_without_reloading` too. The
third, `recordCurrentLocation` in `version.js`, still reads `inPage` on
`main`.

## Change

`focusInPage` moves to `passages.js`, beside `inPage`, and all three
readers import it: one home for the question, with #5468's wording.
`browser/AGENTS.md`, "One answer for each question", names it.

## Evidence

A wheel in a pane, a key, then a window narrowed to 520 px, in Chromium:
on the parent of #5228 and on this branch the page returns to the
paragraph the reader had reached (`scrollTop` 941). With `inPage` back
in the recorder it stays at 0.

Keydown dispatch for a key pressed with focus on the body, on a
workspace of N panes, in ms. The `main` figures are one run at
22accdd, and this branch's the range over three rounds before the
merge:

| Panes | `main` | This branch | Only the recorder back on `inPage` |
| ----- | ------ | ----------- | ---------------------------------- |
| 51    | 2.7    | 0.4 to 0.8  | 2.6                                |
| 201   | 21.6   | 1.0 to 1.3  | 23.8                               |
| 801   | 303.8  | 1.4 to 1.9  | 310.1                              |

On `main`, four times the panes cost 8 to 14 times as much per key,
which root `AGENTS.md`, "Responsiveness", rules out. The last column
shows that the recorder alone holds that cost. I measured `k` and `j`;
the recorder runs on every keydown, so I expect the same of other keys,
but did not measure them.

## What I ran

On the merge with b5f5c5d:

-
`test_a_key_pressed_with_nothing_focused_keeps_the_place_read_in_a_pane`
passes here, and fails on `main`'s runtime with `assert 0 > 0`.
-
`test_a_wheel_or_a_press_on_words_gives_a_pane_the_reading_keys_and_the_walk`
passes here and on `main`'s runtime. #5468 fixed the readers it holds,
so it now guards them.
- `test_motion_preference_changes_are_heard_without_reloading` passes.
Before the merge, the 46 tests by node id that press a reading key, read
the region answer or restore a place all passed at two workers.
- `pnpm run test:runtime` (815 passed) and `pnpm run check:browser`.


`test_a_click_on_a_panes_words_makes_it_the_subject_of_every_scroll_key`
fails here and on `main`'s runtime alike: the resting "Comment on pane ·
Left reading" button that #5428 added covers `#right-start`, so the
click never lands.

I did not run WebKit, or `leaf page check --render` over the corpus. The
change adds no work on the startup path.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…ring probe (#5497)

#5230 made visual review's "Looks right" checkbox a `.choice`, and a
choice's label wears the focus ring for its input (`:is(.lf-choice,
.choice):has(> input[data-lf-focus-visible])` sets `--lf-wears-ring: 1`,
`browser/styles/components/controls.css`). The ring is painted on the
label, but the test probe's `carriesFocus`
(`tests/page_scripts/focus_rings.js`) didn't recognise that declaration,
so it marked the label's ring as not the focused control's and
`current_location_ring` returned `None`. `ringsDrawn` now credits the
box the runtime's `ringBox` (`browser/runtime/focus.js`, exported
through `browser/runtime/check-api.js`) names for the focused control,
so the probe and the runtime share one reading of which box wears a
ring. Only the test probe and the diagnostic check API change; nothing a
user sees changes.

`git bisect run` over the scheduled-run range
`19757c94c59b..8b759a5` found #5230 (`b63836193`) as the first
commit where the journey fails with `the focused destination paints no
keyboard ring`.
`test_an_authenticated_navigation_journey_becomes_credential_free_review_evidence`
(`--run-nightly`) fails on main and passes with this change.

The same step also unblocks
`test_visual_review_keeps_its_inline_comment_editor_in_view_after_phone_resize[600|760]`.
Its earlier `assert_keyboard_focus` calls now pass, and it fails later,
at line 206, with `{'unobscured': False, 'inViewport': False}`. #5475
(#5228) already owns that failure.

<details><summary>Other probe consumers run</summary>

Passed with the change: `tests/browser/controls/test_rings.py`, the rest
of `tests/browser/test_render_visual_review_journey.py`,
`test_a_key_onto_a_control_at_a_scrollers_edge_shows_its_ring`,
`test_escape_on_a_declaring_control_does_exactly_what_it_says`,
`test_a_label_press_keeps_the_controls_current_keyboard_location`, two
`test_render_pages.py` ring tests, and
`tests/journeys/test_render_controls.py` (Chromium). Two tests failed
both with and without the change, so the change didn't cause them:
`test_trace_pointer_annotation_stays_inside_the_panned_image_viewport`
(ring 5px outside the image viewport) and
`test_each_sampled_focus_ring_is_shown_whole_in_its_surface` (the diff
file's inline response, which #5496 targets).

</details>

Closes #5460 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…5505)

Since #5228 made `body` the root of a live revision's patch, a page
module that moves or replaces a direct child of `main` makes every
revision rebuild the whole of `main`: words a script wrote, highlighted
code spans and nodes a module built are taken back, and focus and open
disclosures survive only through carry. This restores the pre-#5228
behavior for `main`'s children, which is what #5228 meant to keep.

**Cause.** The patch rebuilds an element whole when one of its source
children's live nodes no longer stands under it (`atomic` in
`browser/runtime/dom-children.js`). That guards a pass that took an
element's interior, such as the tokenizer replacing a code block's text
with spans. The patch root is exempt, since it's walked into, never
asked. Before #5228 that root was `main`, so a page module relocating
`#mv-moved` into its own box, or replacing `#cloned` with a copy, was
patched around. With `body` as the root, `main` is an ordinary child,
and either move makes it atomic.

**Change.** A new patch rule, `traversed(element)`, names a live element
the patch walks through as it walks the root. The version controller
names `main` (the direct child of `body`); `setRenderedChildren` names
nothing. `dom-children.js` still knows no document. Everything else
under `main` keeps the atomic rule.

**Tests.** These failed on main and pass with the change:

-
`tests/browser/projection/test_revision_patches.py::test_a_revision_leaves_the_page_everything_it_did_not_write`
-
`tests/browser/startup/test_versions.py::test_the_diff_marks_what_the_author_changed_and_no_word_a_script_wrote[classic]`
and `[module]`

The rest of `test_revision_patches.py` passes, apart from
`test_a_revision_releases_the_served_markup_it_removes` (3 cases), which
fails the same way on unmodified main and isn't one of the tests #5475
tracks. `pnpm run test:runtime` (818 tests) and `pnpm run
check:framework` pass.

#5475 lists twelve tests broken by #5228. This fixes two of them; the
other ten are still being diagnosed under that issue.

Refs #5475 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…aying static (#5507)

`test_an_aimed_comment_keeps_its_place_with_on_me_open` asserts that
Leaf's interface root (`.lf-chrome`) stays `position: static`, so an
authored `div { position: relative }` can't capture its coordinate
plane. #5228 deliberately made that root `position: absolute` at the
document origin, at the largest z-index, as `html`'s last child
(`browser/base.css`, `:root > .lf-chrome`), so the assertion fails on
main for both widths even though the plane hasn't moved.

The test now reads what it protects: the root's box, plus the scroll
offset, sits at `[0, 0]` while the page sets a margin and border on
`html` and positions every `div`. The root and body `static` assertions
and the composer placement checks are unchanged. No product code
changes.


`tests/browser/test_render_aim.py::test_an_aimed_comment_keeps_its_place_with_on_me_open[900]`
and `[1200]` failed on main and pass with this change.

Refs #5475 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
#5506)

Since #5228, a page whose `main` leads with an `<h1>` lends that title
to every element on the page with no name of its own. The `s` hints
announce `div: Split` for a wrapper whose words are its two paragraphs,
a chosen list is announced by the page title, and a draft's edit button
reads `Edit “Draft source”` instead of `Edit the draft`. This restores
the pre-#5228 naming.

**Cause.** `addressableLabel` (`browser/runtime/addressable-names.js`)
names an unnamed element by the nearest enclosing name, climbing "short
of the document it stands in (the page's column, or a message's body)".
The climb stops at `authoredScope`, which #5228 widened from `main` to
`body` so content beside `main` belongs to the page. That moved the stop
one level up, so the climb now asks `main` itself, and `main`'s leading
heading is the page's title.

**Change.** The climb also stops at `main`, the direct child of `body`.
Content beside `main`, such as a site header, still climbs to `body`,
and a message body is unaffected. The Python side
(`gesture_words.element_name`) doesn't climb, so it needs no change.

**Tests.** These failed on main and pass with the change:

-
`tests/browser/test_render_semantic_selection.py::test_a_boxless_target_is_read_where_it_paints`
-
`tests/browser/test_render_semantic_selection.py::test_dense_selection_hints_stay_short_and_reach_an_atomic_visual`
-
`tests/browser/test_render_pages.py::test_ship_review_summary_is_addressable_and_baseline_aligned`
-
`tests/browser/drafts/test_draft_editing.py::test_a_draft_uses_shared_editing_and_saves_exact_markdown_source`

A new case in `tests/runtime/addressable-name.test.mjs` puts a leading
`<h1>` in `main` and asserts that it names nothing `main` holds. It
fails without the fix and passes with it.

#5475 lists twelve tests broken by #5228. Together with #5505 (merged,
two tests) and the aim test update, this leaves five still under
diagnosis there.

Refs #5475 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 5, 2026
… root after body (#5513)

Two browser tests still assumed Leaf's interface root (`div.lf-chrome`)
stands inside `body`. #5228 deliberately moved it after `body`, as
`html`'s last child with an empty box (`browser/base.css`, `:root >
.lf-chrome`). Both tests now use the new shape and protect the same
behavior. No product code changes.

-
**`test_live_samples.py::test_tab_walks_into_and_out_of_a_full_view_sample`**
focused `tabStops(document.body).at(-1)` as the child frame's last Tab
stop. That used to be Leaf's panel button; with the root outside `body`
it's now a page `leaf-text`, which script `.focus()` doesn't take, so
the frame never held focus. The child's real Tab order is unchanged and
still ends at the panel button, so the test reads it from
`tabStops(document)`.
-
**`threads/test_layout.py::test_a_short_window_keeps_media_choices_and_send_around_the_scrolling_draft[True]`**
makes the chrome root a scaled containing block with `position: fixed;
inset: 0`. The base rule now gives the root `width: 0; height: 0`, so
the bar's containing block was an empty box and the placement withheld
the field. The fixture now sizes the box too, so the case still tests
placement through a transformed, zoomed containing block.

Both failed on main and pass with this change.

Refs #5475 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
… page (#5511)

Since #5228, focus in a comment editor seated in a widget's outlet no
longer counts as focus in the page, so the version controller never
records it as the user's place, and a resize leaves the editor scrolled
out of view. On the visual review journey at a phone width, the page
stayed at the top with the editor's field at y=1187.

**Cause.** `focusInPage` (`browser/runtime/passages.js`) is `at !== body
&& inPage(at)` after #5228 and #5425, and `inPage` excludes every
runtime surface, `.lf-chrome, [data-lf-runtime]`. The seated editor's
bar carries `data-lf-runtime`, so `recordCurrentLocation` (`version.js`)
returns early for it. Before #5228 the check was `under(at, main)`,
which a seated editor passed.

**Change.** `focusInPage` climbs from a Leaf surface to the element it
is seated in, then asks the original question of that element: under
`body`, not `body` itself, and not a Leaf surface. A comment editor in a
widget's outlet stands in the widget, so it counts. The hidden field
Copy appends to `body`, which `copy-control.js` marks so that its focus
"isn't the page's", stands on `body`, so it doesn't. The chrome stands
on `html`. `inPage` still answers for authored content, and the two
`reading-regions.js` callers keep #5425's exclusion of `body`.

**Tests.**
`tests/browser/test_render_visual_review_journey.py::test_visual_review_keeps_its_inline_comment_editor_in_view_after_phone_resize[600]`
and `[760]` failed on main and pass with the change.
`test_panes.py::test_a_wheel_or_a_press_on_words_gives_a_pane_the_reading_keys_and_the_walk`,
which #5425 added for the `body` case, still passes.

Refs #5475 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…t stand beside (#5512)

On a workspace with two panes side by side, a click on the left pane's
words shows the resting comment box (#5428) over the right pane's first
line. The next click there opens the box instead of reaching the page.
This keeps the box off any target with no margin beside it, as #5428
described: "Without room there, as on a workspace page or in a window
under about 1340 px, it waits for the press".

**Cause.** The placement
(`browser/runtime/annotation-overlay/composing/floating-response.js`)
withholds the resting box only when its seat is above or below the
target. Clicking the pane's words focuses its scroller, so `c` names the
whole pane. The seat on the right has 600 px of room, but that room is
the neighbouring pane, not a margin: a workspace keeps no rail, and a
pane isn't in the column the rail lies beside (`margin-layout.js`).

**Change.** The resting box also waits for `c` when the rail doesn't
stand beside its target. That fact now has one home,
`railStandsBeside(target)` in `margin-layout.js`, which `marginSpot`
reads too; the box no longer infers it from `place.margin`, which can be
a shown row's rectangle wherever the rail stands. Pressing `c` still
opens the comment box. The module header now says so.

**How #5228 relates.** The box came after #5228. #5475 bisected the
panes test to #5228, which first broke it at `userReadingRegion()`;
#5425 fixed that, and the click then hit this box.

**Tests.**
`tests/browser/navigation/test_panes.py::test_a_click_on_a_panes_words_makes_it_the_subject_of_every_scroll_key`
failed on main and passes with the change. The new
`test_the_box_waits_for_the_press_beside_a_pane_the_rail_does_not_stand_by`
covers an empty pane and a pane already showing another comment's pin.
The resting-box tests in `tests/browser/navigation/test_commenting.py`
pass, including
`test_the_box_waits_for_the_press_with_no_room_beside_its_target`.

Refs #5475 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 7, 2026
`test_design_mode_reads_each_shape_of_control_into_the_anchor_its_routes_carry`
has failed on main since #5506. Its "a control's name is its own"
subtest asserts that a field's design label carries no neighbouring
control's words. The `spoken` section had no heading, so the label's
`section:` context came from `main`'s leading `<h1>Settings</h1>`, the
climb #5506 deliberately stopped. Since then the unnamed section is
named by its own words, `Find settings ×`, and the close button's `×`
reaches the field's label through the section's name, not the field's.

The test this case came from
(`test_design_spoken_context_does_not_borrow_a_neighbours_face`, added
in b91b966) gave the section its own `<h2>`. #5409 dropped it when it
merged the case into `CONTROL_SHAPES`, and the subtest kept passing only
because of the #5228 bug that #5506 fixed. This restores a heading on
the section, so the assertion is again about the control's own label,
and #5506's naming stays as it is. No product behavior changes, and
`CONTROL_SHAPES` has no other reader.

**Verification.** The test fails on main `bdc4c03b0` with the issue's
message and passes with this change (35 subtests).

The issue's second test,
`test_render_gate.py::test_scrollbar_clearance_reads_generic_content_and_open_shadow_words`,
already passes on `bdc4c03b0` with no change here. That fits #5662,
which stopped the resting comment box from standing beside a target that
ends short of the column's edge, so the box's `aria-label` no longer
collides with the `First choice` role query.
`test_an_expanded_diff_file_can_retry_its_failed_chunk_in_place` stays
with #5641.

Closes #5645 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 18, 2026
Follow-up to #5965, which grouped `leaf-dev`'s commands: this merges the
developer tooling's internal duplicates, so each mechanism has one home.
52 files, +2541 / −2581; most of the ± is code moving between modules.

### Group helpers instead of command modules used as libraries

- The shared journey machinery (`Isolation`, `Terminal`, `User`, …)
moved out of the command `commands/journey/run.py` into
`commands/journey/_journey.py`, and the harness journeys into
`commands/journey/_claude_code.py`, `_codex.py` and `_pi.py`. `run.py`
keeps the command.
- `logs response-times`' reader moved to `leaf_dev/page_timings.py`,
since the journey, `logs timeline` and `delivery_eval` imported it from
the command; `suite.py` moved to `commands/suite/_runs.py`.
- `dev/AGENTS.md` says where a helper only one group uses goes
(`_name.py`, which `cli.py` lists as no command).
- No eval module moved: none of the moves would remove a cross-group
import, and eval cases name executors by module path.

Command modules other code still imports as libraries remain: `site
verify`'s page and session helpers (the journey imports 12 names, and
this PR adds `load_presented`), `generate corpus`, `preview`'s lease,
`bench` (with `server_paths`, a cycle), `journey snapshots` and `site
build`/`distribution`. Moving them needs about 600 lines out of
`verify`; that's a separate decision.

### `placement pins` on `leaf_dev.visits`

`placement pins` now visits its arms through the loop `placement cards`,
`stills` and `probe` share. Its report and all 52 full screenshots are
byte- and pixel-identical to the old loop's, with and without `--base`.

### Merged duplicates

- `arms.run_leaf(arm | None, state | None, env=, error=)` runs Leaf for
the site build and the fork eval too, from the repository root, against
which a page's layer resolves a relative package such as the docs'
`./docs/package`; `arms.arm_python` builds the command for code run in
an arm's interpreter (five callers).
- `leaf.media.write_media` writes developer media, with
`require_media_type` for the refusal `site media` had copied.
- `site verify` opens each page through one `load_presented`; its
saved-state pass now checks the durable source after presentation rather
than before, which changes only which failure is reported first.
- A process's state home points at scratch through `patch.dict`; visits'
console readings through `collect_page_errors(warnings=)`; a mark's
colour through `panel_paint.ink_box` with a per-channel window, which
reproduces `marked_tops` on 300 blurred frames and runs 9x faster.
- The UI review's `provider.mjs` asks Python for the Claude login home
and environment (`arms.claude_home`, `arms.environment`) instead of
copying them.
- `hook_transport.inline_delivery` reads a hook's inline delivery for
the Claude Code journey, `logs timeline` and the harness;
`arms.phase_traces` splits a stream trace at its `eval_phase` marks
(equivalent on 2,000 random traces).
- The usability eval captures its comment anchors with `anchor_capture`.
Anchors now carry Leaf's captured context and refuse a quote their
element holds twice, as Leaf does, where the hand-built one took the
first match; every anchor the cases and fixtures name still captures.
- `suite flake`, `suite bugback` and eval runs allocate their
directories with `run_directory`, now named `run-YYYYMMDD-HHMMSS-…`;
CI's `run-*` globs still match, and no code parses the name.
- Seven Python copies resolve the host's Claude and Codex config
directories through `leaf.harness`, and five hand-written one-liners
call the library or `leaf_dev` helper they repeated.

Left as copies, because their behaviour differs in ways one parameter
can't carry: `preview`'s own runner (streams stderr, keeps the session
environment, exits with Leaf's status), `eval report`'s Leaf (builds the
developer's own page with their configuration), `control-legibility`'s
provider, Node's `CODEX_HOME` lookup, archiving a sample's pages, and
the judge inputs `regrade.py` and `authoring_assertion.mjs` build, which
name the pages differently, so merging them changes what judges read.

### Checks

- `uv run leaf-dev --help` and every touched command's `--help`;
`placement pins` (with and without `--base`), `placement cards --case
words-long`, `probe` with the `panel_paint` journey, `bench --read
server`, `preview`, `journey chart` and `logs timeline` end to end; the
site build's `page init` from outside the repository root.
- `dev/tests` covering the touched modules, the `tests/` model, process
and browser tests that import them, and pre-commit (ruff, vulture, ty,
knip, prettier, eslint, typos) on every changed file.
- Ten dev tests fail identically on main (`1289a479d5`), so none is this
branch's: `test_preview_file_subscription_follows_atomic_replacements`,
`test_desktop_start_requires_its_validated_native_chat` (3 cases) and
`test_serving_connects_codex_feedback_before_handing_over_its_url` (4
cases) in `test_interact_preview.py`, one case of
`test_product_page.py::test_a_composed_part_refuses_an_authored_copy`,
and
`test_the_page_a_turn_has_just_written_waits_for_its_revision_after_presentation`,
which has failed since #5228 (its fake page returns a list for the new
`innerText` read).
- After merging main (291 commits), main's edits to code this branch
moved out of `journey/run.py` were carried into `_journey.py` (the
seven-character release hash, `open_news`'s selector, `send_comment`
without `passage`); on the merged head, pre-commit, the dev tests, the
product tests over the resolved conflicts (panel paint, pins, frame
marks, website routes, media), `placement pins` (with and without
`--base`), `placement cards --case words-long`, the `panel_paint` probe,
`bench --read server`, `preview`, `journey chart` and `logs timeline`
were rerun.
- An independent review read the branch and reran these; the one
regression it found, the site build failing outside the repository root,
is fixed here.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 18, 2026
… journey does since #5228 and #6090

dev/tests/process/test_website_server.py's fake page still served
locator('main'), which the journey stopped reading in #5228, and expected
an eight-character release marker, which #6090 made seven. The opt-in dev
tests run outside CI, so the drift went unnoticed.
max-sixty added a commit that referenced this pull request Nov 18, 2026
…t has taken 240 s (#6376)

The 240 s `arrived` failures on the starved macOS nightly were deferred
work landing late, not work that never lands. `wait_until_ready` now
gives up only once a page has gone `HANDOVER_DEADLINE_MS` (still 240 s)
without progress, rather than once the whole handover has taken that
long. Progress is a readiness stage the wait hasn't seen, or fewer
arrivals left at its stage than at any reading before
(`HandoverProgress`), read from a new `lfArrivalsOutstanding` beside
`lfReadiness`. A page whose arrivals only make way for others still
fails at the bound. The render gate's shared handover budget goes.

Closes #6302 (its 30 s half was #6310).

Why a progress bound rather than a fourth raise (30 → 90 → 240 s): each
live sample a check starts loads its own page, three at a time, so the
whole handover grows with the page's samples. Reproduced here under
`taskpolicy -b` beside 96 busy loops: on main the feature gallery's
check fails exactly as on the nightly, at 240 s with 43 of 50 arrivals
landed; with the deadline raised all land by 260 s into that wait, never
more than 62 s apart. This branch passes both galleries starved.

To weigh: a sample's whole page is still one arrival of its host, and
the widget upgrade has no finer signal, so each must fit one 240 s
window.

Tests: a new browser test fails on main and passes here, and a model
test covers a page whose arrivals only swing; focused render-gate,
readiness and gallery-check tests, `test:runtime` and `check:browser`
pass. The opt-in website-verifier tests in `dev/tests`, whose fake page
had drifted from #5228 and #6090, pass again. The first commit's message
has the measurements.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 18, 2026
…ey read (#6374)

Ten tests under `dev/tests` failed on main because five main commits
changed what they read, and nothing in CI runs `dev/tests`. Each test
still protects behavior that holds, so the fix is in the tests' fixtures
and expectations; no developer tool changes.

- #5964 put a `leaf` command's refusal in its stdout JSON. The desktop
Codex `server start` cases and the unavailable-delivery `start`/`run`
handoffs in `test_interact_preview.py` now read it there.
- #4198 made the preview follow more files in its checkout. The
assets-pin test's fake checkout now creates every file `worker_inputs`
names, so the preview no longer subscribes the whole checkout
recursively.
- #6237 re-indented `docs/index.html`, and the composed-image case in
`test_product_page.py` matched on the old indentation. It now matches on
`alt` alone.
- #5228 changed the journey's page-text read, and #6090 shortened the
release marker to seven characters. `test_website_server.py`'s fake page
and its expected marker follow both.

To weigh: these breaks went unseen for up to three weeks because
`dev/AGENTS.md` keeps `dev/tests` out of every CI selection. This PR
leaves that rule unchanged.

Dispatched by max-sixty from the session that landed #6014. Tests: the
three changed modules, 91 passed on macOS.

> _This was written by Claude Code on behalf of max-sixty_
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.

A page's own header, nav and footer can stand beside main, as on an ordinary site

2 participants