Skip to content

Add page-level navigation with root tabs - #739

Merged
max-sixty merged 5 commits into
mainfrom
codex/root-tabs
Sep 15, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/root-tabs

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Leaf artifacts can now present several page-scale views without splitting their conversation, asks, or revision history across separate pages. A root lf-tabs after an optional page header becomes borderless sticky page navigation; the same markup remains a framed tabbed section when embedded in document flow.

The root form uses native fragments and browser history, restores the document reading position for each prose tab and pane positions for bounded workspaces, opens destination tabs for links, search, comments, and Ask travel, and exports every panel in authored order. The browser runtime exposes one generic composition transition around the existing reading-region continuity owner, while the tabs package owns root placement, navigation, and presentation. The registry declares page-navigation capability so version check does not suggest a contents sidebar that would displace the root composition.

The fixture and browser coverage exercise page and embedded placement, dynamic context changes, native Back and Forward, reading continuity, bounded and narrow workspace layouts, global Ask and fragment travel, reload, and static export. The feature gallery, package registry, authoring references, glossary, TODO, and generated corpus are updated with the resulting contract.

Validation: 1,126 everyday tests and 310 widget/navigation browser tests passed; pre-commit passed; light and dark desktop and mobile render checks completed with no console errors.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three findings, all on the new root composition. The first is a visible defect in a static copy that the PR's own export test cannot catch; the other two are shipped guidance that steers an author out of the composition this PR adds.

A static copy stacks every panel when the active tab holds a bounded workspace. The new structural block in theme.css puts main in display: grid and pins every > lf-tabs > lf-tab to one grid cell, keyed on data-lf-reading-posture="bounded" inside a bare @media screen. A copy unhides every panel but keeps those attributes, so all of them land in that cell. Reordering this PR's own fixture so the Workbench tab comes first and exporting it, the three panels report identical top. Mechanism, measurement, and the precedent rule that states the invariant being broken are inline on theme.css and on the export test.

leaf version check advises a placement this composition forbids. missing_outline in skills/leaf/scripts/leaf/validation/markup.py exempts a page whose main holds exactly one substantive root element with x-reading-role: workspace. A root tab set is a second whole-page composition it does not know about, so on this PR's own fixture the check reports 22 headings and no <lf-toc>: one in an aside.sidebar near the opening lists them. Following that advice puts an aside.sidebar inside main, which takes the tab set out of root placement — there is no position inside main that satisfies both the advice and the composition. The lf-toc entry carries the same exemption in prose ("Workspaces use their region navigation instead of a page-wide contents sidebar") and needs the tabs case alongside it.

The registry and the authoring reference understate the precondition. #syncRootContext requires main to hold the tab set last and, before it, either nothing or a single header. Both documents state only "no substantive content after the tab set", and the registry actively directs the author to "Keep the shared title and lede before a root set" — written the way every other Leaf page writes a title and lede, that is a bare h1 plus p.lede, which makes three substantive children and silently yields the framed embedded form (measured: data-lf-tabs-context="embedded", 1px border, no fragment). Suggestions inline on both files.

Comment thread skills/leaf/packages/default/theme.css Resolved
Comment thread tests/test_render_widgets.py Resolved

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding left on 1678823. The regeneration commit is exactly what scripts/keydocs.py plus prettier produce here, so the test job's only failure on the previous head is gone. Of the four earlier threads, three are addressed and resolved; the copy thread is half-addressed and stays open under the finding below.

A root-tabs copy still reads whichever tab happened to be open at export. The new html.lf-copy block removes the grid, which the reworked export test now genuinely pins, but it restates only height and display. The rest of the live root box — width: 100cqi, max-width: none, margin: 0, padding: 72px var(--col-pad) 0, left: 0 — is keyed on the active panel holding a bounded workspace and has no copy-side counterpart, so it survives into the copy and the exported page box becomes a reading of the export-time tab. Mechanism, both measurements, and the two directions a fix could take are inline on theme.css.

Comment thread skills/leaf/packages/default/theme.css Resolved
@max-sixty
max-sixty merged commit f885bb1 into main Sep 15, 2026
16 checks passed
@max-sixty
max-sixty deleted the codex/root-tabs branch September 15, 2026 20:48
max-sixty pushed a commit that referenced this pull request Sep 15, 2026
`ci` on main [run
35021853659](https://github.com/max-sixty/leaf/actions/runs/35021853659)
failed on
`tests/test_render_application_boundary.py::test_current_readiness_releases_a_connected_page_widget`,
which expected `data-render-order` to read `render,subscribe,` and got
that pair four times over. The run is recorded as cancelled because the
everyday `test` job failed and the steps behind it were dropped; the
failure itself is the test.

Four pairs is the settled value, not a corruption. One gesture publishes
four distinct widget readings on its way through the round trip: the
optimistic one the dispatch makes, the delivery outcome, the admitted
event replacing the pending id, and the cleared ledger. The widget
clears `data-render-order` in `choose`, so the attribute holds one pair
for as long as the round trip takes and then grows to four.
`expect(...).to_have_attribute` returns on the first matching frame, so
the assertion only passed while its first poll landed inside that window
— the transient the auto-retrying assertion was never meant to wait for,
per **A state the page passes through is not a state to poll for** in
`tests/CLAUDE.md`. On a loaded runner the round trip finished first and
the poll read the settled value.

The claim the assertion is making — the optimistic publication renders
the owner and then runs its subscribers, before the log answers — is
true synchronously inside the click. So the order is now read in the
same `page.evaluate` that presses the button, where nothing can have
arrived yet, and the contract for the readings that follow is stated as
the property that holds of all of them: after `round_trip`, every
recorded subscriber ran behind its own reading's render. Neither read
can be overtaken by the delivery.

The test is unchanged since #666 and this is its first failure; the race
is latent rather than new, and [PR #739's own `test`
job](https://github.com/max-sixty/leaf/actions/runs/35019652548/job/104552424929)
passed on the same tree that failed here.

<details><summary>Reproduction</summary>

The CI value reproduces exactly on a fast machine by delaying the read —
a copy of the test with `page.wait_for_timeout(500)` before the original
assertion:

```
E       AssertionError: Locator expected to have attribute 'render,subscribe,'
E       Actual value: render,subscribe,render,subscribe,render,subscribe,render,subscribe,
```

Instrumenting the widget's subscriber to record each reading shows the
four publications the round trip makes: pending event with `delivery`
unanswered, `delivery` answered, the admitted event with its `id`/`seq`
in provenance, history and standing, and `delivery` empty.

The repaired test passes with a 1.5s delay inserted before the settled
read — the arrangement that reproduced the failure. `uv run pytest
tests/test_render_application_boundary.py` passes (8 tests), and
pre-commit passes on the changed file.

</details>

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 24, 2026
Leaf had two exports. The static one froze the drawn page, stripped
every script, and marked the root `html.lf-copy`. The
offline-interactive one (`--interactive`) embeds the page's own runtime
and its captured state, so the page draws itself when the file opens.
This removes the static export. `leaf version export` now writes only
the offline file, and takes no flag.

## Why

With no script in the static copy, every feature had to say what it
looks like without its JavaScript. That took:

- about 90 `html.lf-copy` / `html:not(.lf-copy)` selectors across 8
stylesheets;
- `lfPrepareExport()` hooks in five widgets;
- runtime attributes that existed only for the copy (`staticLabel`, the
tab-icon rest link);
- a 541-line bake probe;
- about 2,000 lines of tests, including a corpus-wide export test that
fails whenever a new widget arrives.

Since August, 131 commits touched the export files and 77 touched
`lf-copy`. Main still carries one from today: #1132 fixed a nightly
failure on a copy width.

The case that surfaced this was How it works in a static copy. The #739
rule `html.lf-copy body > main:has(> lf-tabs…)` stretched its text to
the full window (1392px paragraphs, all five tabs stacked). The offline
file draws the same page exactly as the site does: 720px paragraphs and
a working tab strip. Its runtime is the live page's, so new features
need no export-specific handling.

## Changes

- **`exporting.py`**: `cmd_export` always builds the offline file
(`export_document`). The browser bake and its readiness waits are gone.
A page with a live specimen is refused, as `--interactive` already
refused one.
- **Render checks**: `standalone.js` is deleted and `coveredWords` moves
into `words.js`. The file:// probe route, `prepare_standalone_probes`,
and `EXPORT_FLOOR` are gone.
- **CSS**: every `html.lf-copy` rule is deleted, including the copy
scroll-cue timeline in shadow.css. Some screen rules had depended on the
class weight of `html:not(.lf-copy)`; without it, the "Another option"
textarea took the runtime's textarea border. That guard is now
`html:root`, which has identical specificity, and theme.css states the
convention. `:where(html:not(.lf-copy))` wrappers carried no weight and
are unwrapped.
- **Runtime and widgets**: the `lfPrepareExport` hooks, `staticLabel`,
`data-lf-rest`, `data-lf-export="document"` on specimen frames,
`serializable` shadow roots, the live-leaves detached-tray guard, and
comments that argued from the copy are all gone.
- **Tests**: the static-copy tests are deleted. `--interactive` tests
drop the flag. UTF-8, captured-CSS and CSP checks now run against the
offline file. The corpus-wide static export test is deleted.
- **Docs**: `serving-pages.md` "Exported files" describes the single
export. Package guidance no longer asks widget authors to design for a
script-free copy.

## Verification

- **Computed styles**: across all 17 examples, every element's computed
style (document and open shadow roots) was diffed between the base and
this branch at 1440px. There were no differences beyond the removed
`--lf-copy-*` properties and the timing noise a base-vs-base control
also shows.
- **Suite**: the full nightly suite passes, except
`test_visual_review_guides_one_typed_still_run`, which fails the same
way on main at c61f52f.

## What this drops

- Exported files show no conversations: the offline runtime boots with
the conversation surface off.
- Pages with live specimens (the corpus, the feature gallery,
`docs/event-log.html`) can't be exported.
- The offline file embeds every vendored bundle: 11.8 MB for How it
works, against 630 KB static.

Each is a follow-up.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants