Skip to content

Revert drawing the contents map before the page upgrades - #4179

Merged
max-sixty merged 2 commits into
mainfrom
revert-toc-first-frame
Oct 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
revert-toc-first-frame

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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 Draw the contents map's spine and markers in their first frame #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

max-sixty and others added 2 commits October 25, 2026 20:20
This 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. 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 drop the early layout rather than narrow the rule
(#3962): the map keeps appearing when the page's code loads.

The layout moves back from `toc-view.js` into the module, the initial
renderer again only draws the outline, and `.lf-ui`'s `box-sizing`
reset returns from the render-blocking theme to `runtime/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.
The conflicts were in `TODO.md`, whose item #3931 deleted now has no
home since the backlog moved to issues and the user decided against
it, and in the test file, where main had since changed the deleted
test's teardown.

Ran: `pnpm run build:browser` (no change to the committed bundles),
`pnpm run check`, the `lf-toc` tests in `test_contents_and_glosses.py`
in Chromium, and in Firefox through a temporary fixture override (the
same three tests fail on the base under that override, none of them
toc-specific), `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`. A probe of
`docs/extending.html` at 1440x900 with `--base`, in Chromium and
Firefox, found the upgraded map's seven markers at the same positions
on both arms, with pixel-identical stills; 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.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty marked this pull request as ready for review October 27, 2026 05:18
@max-sixty
max-sixty merged commit f324b7a into main Oct 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the revert-toc-first-frame branch October 27, 2026 05:35
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