Repository navigation
Link contents to semantic sections - #372
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Read the diff and the surrounding code; I have no findings on the change itself. Holding the approval only because ci / test is red on this head.
That failure looks unrelated to this PR. The everyday suite is green (898 passed, 6 skipped); the red is in the touched-module nightly gate, at test_other_responses_can_turn_the_compact_field_into_a_suggestion — .lf-fab-bar reads hidden after the Tab that should enter the other-responses row. The only runtime file this PR changes is lf-toc.js (plus the lf-toc description string in the registry), and that test's fixture — INLINE_PAGE in tests/render_harness.py — contains no <lf-toc>, nor does leaf_page inject one, so the widget never upgrades on that page. The failing assertion sits in the reactions/FAB surface that #365 rewrote; #365 is this branch's merge base and main's current tip, and it is also the last commit to touch this test. Main's own ci run at that commit was still in flight when I checked, so I have not confirmed the failure reproduces there.
What I checked on the change
- All 39 heading ids the diff removes have no remaining reference anywhere in the tree — no
aria-labelledby, seeded log anchor (feature-gallery.jsonl,ship-review.jsonl,log-retention.jsonl), test, or doc. The one id kept for an ARIA relationship is renamed and matches itsaria-labelledbyin both the gallery and the corpus. - Walked every example statically against the new
#destinationForrule. In the feature gallery (max-level="2") every outline row resolves to asection, which is what the rewrittentest_the_feature_gallery_sections_are_stable_preview_destinationsasserts; elsewhere the fallbacks land where the widget's header says they should — a heading inside anlf-tab(pr-walkthrough's two<h3>s under#pr-system) still gets its own generated target inside the tab, so hidden-until-found still reveals it. - Section destinations are usually taller than the viewport, so
readableDestinationis now false on a fresh fragment arrival andlandArrivalrunsscrollToElement. That lands in the same place:centreByclamps an element with no middle to show toscrollPaddingTop, which is where the native jump already put it. - Removing the ids doesn't disturb the version comparison —
diffBlockskeys text blocks by authored words, not by id.
#373) `main` has been red on the nightly ring census since #365. The corpus walk waits for the page to stop moving and it never does: three CSS transitions on a reaction pill's tooltip label restart every frame, so the label never outlives its own 90ms delay — it is invisible for the page's whole life — and `pageSettled` can never go true. ## The loop A docked margin row is floated back into the rail every pass to ask whether it fits now, and docked again when it does not. That round trip runs through `moveHost`, which relocates a cluster that may hold the reader's focus: the move emits `focusout` and the restore emits `focusin`, both of which reach `paintHere()`, and the resulting paint runs `syncLayout` → `dockSeats` → another pass. #365 made the cycle reachable from both ends. `dockSeats` schedules a pass whenever a reaction seat stands anywhere on the page, and the six emoji it moved into the margin mean one always does; and it put the focused control inside the host being moved, which is what turns a placement into focus traffic. `anchors.js`'s `dockSeats` comment records the same shape being cut once before — "a whole margin render every frame with nothing dispatched and nothing moving… ~350ms of main thread a frame". This is that cycle closing again through a consumer that did not exist then. ## The change A dock is an answer about a width, so it holds while the width it answered about holds. The pass remembers the room each row docked against and keeps that answer until the room changes or the row restates itself through `registerMarginRow`/`updateMarginRow`, whose own size is the other half of the answer. The measurement that could not have answered differently no longer moves the reader's focus to prove it. The tooltip is user-facing, not only a probe: before this, focusing a reaction pill showed no label at all, and the page never stopped animating. ## Verification - `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` passes; it failed five times running on `main` - Paired control: the same test passes at `5d571319` (the four merges before #365) and fails at `06daeef3`, isolated `-n0`, same machine - `uv run pytest tests/test_render_margin.py tests/test_render_controls.py tests/test_render_navigation.py --run-nightly` on the merged tree: 250 passed, 5 failed - Four of those five are `main`'s own, confirmed against a detached checkout of `8fbf925c` carrying none of this branch: both `test_an_unchanged_heartbeat_restates_no_margin_name` cases and both `test_the_small_screen_map_is_a_complete_accessible_sheet` cases - The fifth, `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` at `22 <= 20`, was contention from `-n 2`; isolated it passes - `uv run pre-commit run --files skills/leaf/assets/runtime/margin-layout.js` clean Review found one fault in the first version of this change and `41f940d0` folds it in: a row the posture read keeps docked reached the classification loop with `hangs === true` and its docked rect, so `rect.right > room` was false and it fell through to `inMargin` — counted as hanging in the margin while standing in flow. Every `staysDocked` member used to carry `hangs === false` and re-enter the docked branch on its own, which is the invariant the new member broke. ## The other #365 red, and where it went `test_other_responses_can_turn_the_compact_field_into_a_suggestion` was red on `main` for a second, unrelated reason: one Tab from the compact composer focuses the fab bar's Other responses trigger, which raises the margin surface, and `.lf-fab-bar[data-lf-margin-raised] { display: none !important }` then hides the bar the reader is standing in. That was #365 moving where Other responses renders, not a fault, and #372 has since settled it: the case is now `test_reactionless_other_responses_can_turn_the_compact_field_into_a_suggestion`, which serves a layer with the reaction tokens stripped and asserts Suggest stays in the compact fallback there. Both readings pass on this branch with `main` merged in, so `main` goes green on the nightly ring census and on that case together. ## Why nothing caught it #340's gate runs the nightly modules a pull request edits. #365 edited twelve test modules, and neither of the two it broke was among them. The full nightly behind that gate has not completed on `main` since `934bfc4c`: four of the six runs after it were cancelled by the next merge landing first. > _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 (1M context) <[email protected]>
Table-of-contents links now target the semantic section a heading titles, so fragment navigation keeps an eyebrow and heading together below the sticky header and exposes meaningful public URLs such as
#bg-interactions.This cuts the website examples and their revision fixtures over completely: redundant
-headingIDs are removed, the generated corpus and navigation tests use section destinations, and the remaining heading ID is named for its actual ARIA title relationship. The page-authoring reference, widget registry, developer-preview workflow, andexamples/CLAUDE.mdnow describe the same section-first contract and explicitly reject compatibility aliases in current pages and tests.The integration with current
mainalso updates the compact-response navigation coverage for the reaction cutover: the default layer keeps its six direct reaction controls, while the existing Suggest activation, quote-prefill, send-label, and composer-geometry checks now exercise the supported reactionless fallback.Checks:
uv run pre-commit run --all-files;uv run pytest tests(904 passed); live feature-gallery navigation at 1200×900 with no console warnings; context-blind first-use check reached#bg-interactionswith its eyebrow and heading fully visible.