Skip to content

Paint drawn interface before upgrade, holding back only its controls - #3962

Closed
max-sixty wants to merge 6 commits into
mainfrom
grind/s-ui-gate
Closed

max-sixty wants to merge 6 commits into
mainfrom
grind/s-ui-gate

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Before upgrade, the theme hid every generated .lf-ui element in main, and the shadow sheet did the same in shadow trees. Now it hides only what a widget builds to be worked: the elements offer marks with data-lf-offer. Everything else an initial drawing lays out paints with the authored page. That includes the contents map's spine and markers (#3931 draws them in their first frame) and external link marks. No per-widget exemption is needed.

The new rule is html[data-lf-interactive] body:not([data-lf-upgraded]) > main .lf-ui[data-lf-offer], and .lf-ui[data-lf-offer] under --lf-before-upgrade in SHADOW_LEADING_CSS. Both are narrower than before, so nothing that showed before upgrade is newly hidden.

Why the gate can't go entirely

With the rule removed, the controls an initial drawing draws are visible before their module has loaded. Every press tried on them, with leaf.js held and then released, did nothing or was undone:

Control (page) Press before upgrade Same press after upgrade
lf-shot Pair (release-notes) nothing switches the view
lf-motion play (motion-playground) nothing; clock stays 0 ms plays to 2108 ms
playground preset "Needs attention" (notification-playground) nothing sets status strip, urgent
playground radio Urgent (notification-playground) checked, then unchecked by upgrade stays checked
lf-activity Show activity (docs/event-log) nothing; stays collapsed expands

The narrowed rule keeps those hidden: every one of them carries data-lf-offer. Hidden, a control takes no press or focus of its own. A press can still reach it through an element that isn't generated interface: a playground choice's <label> checks its hidden radio before upgrade, and the upgrade unchecks it. This happens on main too, and the theme comment now says so.

Keyboard focus on the contents map

The map shows its labels on hover, or on the focus marks focus.js writes (data-lf-focus-within). Before upgrade nothing writes those marks. With the map painting early, Tab therefore landed on its labels while they stayed at opacity 0, ringed but unseen; on main the gate hid the map and Tab passed it. packages/default/styles/toc.css now gives the margin map's labels visibility: hidden until upgrade, unless the map is hovered or is an always-open outline. Tab passes them, hovering still shows them, and the spine and markers still paint.

The rule sits beside the reveal it stands in for. Among the generated interface that now paints before upgrade (external marks, the map, one-pixel screen-reader words), the map's labels are the only things that take focus, so no other case needs the same treatment. An always-open outline's labels, such as the docs/data-structures sidebar, are visible and take focus before upgrade. They show the browser's own focus ring, since Leaf's ring waits for focus.js.

What changes, measured against main

The measurement covers all 31 pages in examples/*.html and docs/*.html at 1440x900. Each page was loaded once with leaf.js held until the document had parsed, then released, and once normally. Every .lf-ui in the body, and in open shadow roots, was sampled each frame until data-lf-upgraded. The table counts what is visible before upgrade inside main.

main this PR
Pages with generated interface visible in main before upgrade 0 13
data-lf-offer elements visible before upgrade 0 0

The 13 pages differ only in these kinds:

Kind Pages Moves before upgrade, relative to its anchor
External link mark (prepaint) 12 0
lf-toc nav: spine, markers and labels (initial drawing) 8 0 at upgrade; see below
lf-code, lf-old, lf-new one-pixel screen-reader words 2 0

Two pages' contents-map nav changes size while the document is still parsing, before any module runs. On docs/data-structures, the sidebar map widens from 24px to 312px within 25-32 ms. On pr-walkthrough, the nav grows from 22px to 240px tall within 5 ms. On main the old rule hides both changes. The initial drawing from #3931 draws the outline once the document has parsed, which is why the box changes during parse.

The contents maps on these pages are inside main, so the old rule did hide them on main. The new test fails on main's rule because the spine computes visibility: hidden. Interface outside main is the same on both: the floating panel, legend and margin entries.

Tests

All three are in tests/browser/startup/test_presentation.py.

  • test_drawn_interface_paints_before_upgrade_and_its_controls_wait holds leaf.js. It checks that the margin map's spine and markers and an external mark are visible, and that Show activity is attached but hidden. After release it checks that Show activity shows and that no marker moved more than 0.5px. Against main's rule it fails with 'hidden' == 'visible' on the spine; with no rule it fails because Show activity is visible.
  • test_tab_before_upgrade_lands_only_on_what_it_shows presses Tab 12 times with leaf.js held, in Chromium and Firefox, and checks that every stop paints. Without the toc.css rule both engines put focus on six hidden labels before the page's own link (['a', False] ×6).
  • test_a_shadow_tree_holds_its_controls_until_the_page_upgrades holds lf-activity's module, so the page stays before upgrade while lf-diff's module builds its shadow tree. It checks that the tree's offered controls are hidden and its no-newline note shows, and that after release everything shows. It fails when the shadow sheet's selector matches nothing (the controls show) and when it is .lf-ui again (the note is hidden).

Ran

  • The three tests above, with the failing controls described.
  • 111 browser tests selected by grep for held **/leaf.js, data-lf-upgraded, --lf-before-upgrade, SHADOW_LEADING, external marks, lf-toc, and the shot, motion, playground and activity controls: 151 passed, run at -n 2 with the one-minute load at 46.
  • pnpm run test:runtime (550 pass) and pnpm run check:browser.

Not verified

  • What the sidebar map paints in the frames before the document finishes parsing. A slow-link run didn't keep parsing going long enough to capture it.
  • WebKit, and Firefox beyond the Tab test. The inventory is measured in Chromium's headless shell.
  • The journeys tier (tests/journeys/test_render_startup.py, test_site.py).

Calls Max may reverse

  • Controls that modules build, such as lf-option picks and lf-tabs strips, still wait for the whole page's upgrade, as on main, even though their modules already answer them. Showing them as each widget's module takes over would need a new mark on drawn hosts.
  • Before upgrade, the margin map's labels are reachable by pointer only. Hovering reveals them. Those whose heading has an authored id are links that navigate when clicked. Those without one are <a> without href until the module lends the heading an id (toc-view.js), so they are words that don't navigate. Tab skips them all until upgrade. Revealing them on native :focus-within instead would let a keyboard reader use the map before upgrade, but would style focus from a second source beside focus.js (browser/AGENTS.md).
  • The playground label route above is left as on main. Closing it would mean marking the choice's label as generated interface, which changes how it is styled.

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

max-sixty and others added 6 commits October 25, 2026 07:52
The margin map's posture (opening the disclosure while CSS hides its
summary), each row's share of the document and the label fit now live in
the drawing (`toc-view.js`), which the initial renderer and the module
share. The initial renderer runs them once the document has parsed, so
the map's rows and markers are laid out before any module runs; the
module remeasures through the same call and keeps the lens, the current
entry and focus.

The drawing measures in viewport coordinates, since it has no scroller
before the runtime; the module adds the scroller's offset, which is what
its own measurement added before.

On docs/event-log.html at 1724x900 with leaf.js held, the disclosure is
open and the track 780px tall at parse end (before: closed, 0px), and
every marker stands within 2.1px of where upgrade measures it. The
theme's pre-upgrade hide of generated `.lf-ui` chrome in main still
keeps the map out of sight until upgrade.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Until the whole page upgraded, the theme hid every generated `.lf-ui`
element in main (and the shadow sheet the same in shadow trees). Initial
drawings now lay much of that interface out at its final box before any
module runs, so the gate hid things that were already right: a contents
map's spine and markers, an external link's mark. It now hides only what
a widget builds to be worked, the elements `offer` marks with
`data-lf-offer`, which is the property that needs it: an initial drawing
draws those controls before the module that answers them exists.

What the gate hid, measured across examples/ and docs/ (31 pages,
1440x900, leaf.js held to the document's end and released, then an
ordinary load; every `.lf-ui` in main sampled each frame):

- Drawn before any module, by initial drawings and prepaint: 72 external
  link marks, the margin and sidebar contents map's nav
  (8 pages), lf-shot's toolbar, lf-motion's transport, lf-playground's
  choices, inputs, presets, Reset and Submit, lf-activity's Show
  activity. None moved against its anchor between first paint and
  upgrade, except a playground preset row on code-comparison (14px) and
  the sidebar map's nav on docs/data-structures, which widens from 24px
  to 312px when the document finishes parsing (24-48ms after it first
  paints there).
- Built by modules before the page finished upgrading: lf-option picks,
  lf-options' Add field, lf-tabs and lf-parts strips, atlas task
  controls, and package controls (sort-film, code-reader-comparison,
  release-query-explorer). All moved 0px.

With the gate removed, pressing a drawn control before upgrade failed
in every case tried: lf-shot's Pair, lf-motion's play, a playground
preset, and Show activity did nothing (the same press after upgrade
works), and a playground radio checked before upgrade was unchecked
again by the upgrade. So the controls still wait; everything else drawn
paints with the authored page. Afterwards the only generated interface
showing before upgrade on those pages is the external marks, the
contents map's nav, and the one-pixel screen-reader words of lf-old and lf-new, and
no `data-lf-offer` element.

The new startup test holds leaf.js and checks that the margin map's
spine and markers and an external mark paint, that Show activity is
attached but hidden, and that upgrade moves no marker more than 0.5px.
It fails with the old gate (the spine is hidden) and with no gate (Show
activity is visible).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-layer-client.js
#	packages/default/initial/lf-toc.js
#	packages/default/vendor/lf-toc-initial.js
#	packages/default/widgets/lf-toc.js
#	packages/default/widgets/toc-view.js
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With the map's spine and markers painting before upgrade, Tab reached its
labels too. The map shows a label on hover or on the focus marks focus.js
writes (`data-lf-focus-within`), and before upgrade nothing writes them,
so focus sat on a label at opacity 0, its ring drawn on nothing. On main
the gate hid the whole map, so Tab passed it. Until upgrade the map's
labels now take `visibility: hidden` unless the map is hovered or is an
always-open outline, so Tab passes them and hovering still shows them.
The rule sits beside the reveal it stands in for, in toc.css. Among the
generated interface that now paints before upgrade (external marks, the
map, one-pixel screen-reader words), the map's labels are the only things
that take focus.

Tests:
- Tab before upgrade lands only on what shows: 12 Tabs with leaf.js
  held, Chromium and Firefox. Without the toc.css rule both engines put
  focus on six hidden labels (`['a', False]` x6) before the page's own
  link; with it, every stop paints.
- A shadow tree holds its controls until the page upgrades: lf-diff's
  module builds its tree while lf-activity's module is held, so the page
  stays before upgrade. Its offered controls are hidden and its
  no-newline note shows; after release all show. It fails when the shadow
  sheet's selector matches nothing (controls visible) and when it is
  `.lf-ui` again (the note hidden).

The theme comment now says what the gate guarantees: an offered control
takes no press or focus of its own before upgrade, but a press can still
reach it through an element that isn't generated interface. A playground
choice's label checks its hidden radio, and the upgrade unchecks it (also
true on main).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Closing: Max chose to keep main's pre-upgrade rule and revert #3931 instead, the simpler system; the contents map keeps appearing when the page's code loads. The branch keeps this change.

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

@max-sixty max-sixty closed this Oct 26, 2026
max-sixty added a commit that referenced this pull request Oct 27, 2026
Reverts #3931 (8143581), which laid out `lf-toc`'s margin map (its
open disclosure, each row's share of the page and the fitted labels) in
the initial drawing, before the module upgrades.

**Why.** The theme's pre-upgrade rule, `html[data-lf-interactive]
body:not([data-lf-upgraded]) > main .lf-ui {visibility: hidden
!important}`, hides every row and marker of that map until upgrade, so
the early layout drew nothing a reader could see. The user chose to keep
that rule and take the early layout out rather than narrow the rule
(#3962): the map keeps appearing when the page's code loads.

**What it removes.** 477 lines deleted and 200 added, net −277:

| | added | deleted |
|---|---:|---:|
| Hand-written source and test | 191 | 300 |
| Generated (`lf-toc-initial.js` bundle, `shadow.css`,
`runtime/chrome.css`) | 9 | 177 |

- The layout (`posture`, `measure`, `fitLabels`) moves back from
`toc-view.js` into `widgets/lf-toc.js`, and `initial/lf-toc.js` again
only draws the outline.
- `.lf-ui`'s `box-sizing` reset returns from the render-blocking theme
(`components/surfaces.css`) to `styles/chrome.css`, where it stood
before #3931 moved it for the early measurement.
- `test_the_reading_map_first_paints_its_spine_where_it_keeps_it` goes
with the behavior it held.

No later commit built on the reverted code. Two files conflicted. In
`TODO.md`, #3931 had deleted the "Draw the contents map's spine in its
first frame" item; the backlog has since moved to issues, and the user
decided against the feature, so the item is not restored. In the test
file, main had since changed the deleted test's teardown.

**Verified.**

- `pnpm run build:browser` leaves the committed bundles unchanged, and
`pnpm run check` passes.
- The `lf-toc` tests in `test_contents_and_glosses.py` pass in Chromium.
In Firefox, through a temporary fixture override, the same three tests
fail on this branch and on the base, and none of them is about the map.
- `test_render_initial_delivery.py`,
`test_initial_drawings_keep_their_nodes_and_wrapped_geometry_on_upgrade`,
`test_bundled_widgets_meet_the_widget_quality_checks`,
`tests/model/test_interact_layer.py` and
`test_a_coined_class_cannot_reach_the_chromes_rules` pass.
- `leaf-dev probe docs/extending.html --base` at 1440x900, in Chromium
and Firefox. After upgrade, the map's seven markers stand at the same
positions on both arms, and the viewport stills are pixel-identical.
With `leaf.js` held, every row and marker computes `visibility: hidden`
on both arms in both engines, and Chromium's held stills are
pixel-identical. The one difference is invisible: on this branch the
held map's disclosure is closed and its hidden markers are evenly
spaced.

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

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
…ir reviews pass (#4511)

Renames `/grinding-backlog` to `/fan-out-backlog` and revises it with
what the first campaign's later stages showed: its drafts going stale
while they waited, the user's reversals, and Tend's review findings.

- **When to run one.** The maintainer isn't sure a backlog campaign
beats doing work as it comes up, and prefers that by default. So the
skill says to run one only when there are many spare tokens, not on a
schedule or from Tend.
- **Land as you go.** Once a PR's review and the reviews of its fixes
pass, the campaign marks it ready, and Tend reviews and lands it under
`running-tend`'s **Landing**. In the first campaign, drafts held for the
user waited 50 hours at the median while main took 297 commits. Other
sessions fixed 6 of the 47 first, and the user then landed the rest with
one choice.
- **Additions wait for the user.** A PR stays a draft, with its decision
on the user's page, when it leaves the user a call or adds something
beyond the repair and its test: a new mechanism, gate, public option,
dependency or protocol bump. The author's report lists these under a new
`adds` field, and the reviewer checks the list. Each PR the user
rejected or cut was an addition of this kind (#3876, #3896, #3854,
#3962).
- **Review weighs additions and every fix.** Reviewers weigh what a
change adds (`/developing-leaf`, "Weigh what a change adds") and review
every fix again. One unreviewed fix in the first campaign moved #3904's
check into the build and broke the eval comparison arms, until #4486
moved it back.
- **Counts come from GitHub**, since an orchestrating session that
compacts several times loses its counts. Ready PRs go a few at a time,
since six parallel landing agents once used up Tend's GitHub API quota.

> _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.

1 participant