Skip to content

Keep go-to hints on screen and reveal contents labels - #210

Merged
max-sixty merged 3 commits into
mainfrom
codex/goto-hints
Sep 2, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/goto-hints

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Pressing g could clip navigation hints at the left edge while the contents labels stayed hidden. Keep each hint inside the viewport below the banner, place it above its target, and check collisions after placement. The contents map reveals its labels as it does on hover until the go-to chord closes.

The release-notes example demonstrates the behavior, and its generated corpus is updated. Browser coverage checks viewport edges, banner clearance, collisions introduced by clamping, label visibility, and Escape behavior. Existing browser assertions also follow the current print outline and narrow banner overflow behavior.

Validation: 798 everyday tests, 149 navigation and widget browser tests, and pre-commit checks passed. I also checked the live examples at 1200 and 1440 pixels in both color schemes and verified reduced-motion and chord exit behavior.

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.

Read the diff and the enclosing paintAddresses/setChord in full. Nothing blocking: the clamp re-establishes everything the removed .lf-in path did, data-lf-goto is written from the single setChord door so it can't strand, and adding it to PAGE_PAINT_ATTRIBUTE gets the shallowSigs exclusion for free. ci / lint and ci / test are green on e61b477.

One thing worth knowing before either lands: #209 edits the same line of the same function. It replaces const kept = [keylineEl.getBoundingClientRect()] with a height guard, because a coarse pointer draws no key line and the zero box it leaves is an empty rectangle at the window's origin. This branch rewrites that whole loop and keeps the unguarded form (address.js:343). The hazard is neutralised here rather than fixed — Math.max(covered, …) puts every chip box at top >= covered >= 0, and overlaps then needs a.top < 0 to match a rect at the origin, which can't hold. So whichever merges second conflicts, and the guard reads as redundant against this loop even though it is load-bearing against the one it was written for. Worth deciding once rather than at conflict-resolution time. tests/test_render_navigation.py is the second contact point.

I'm holding the approval only because the rollup carries a terminal tend-review / review FAILURE — that is the stranded session-limit run from the 04:39–04:46 outage recorded in #206, not a signal about this code.

Verified, and what I refuted

Checked and found sound:

  • transform: translate(-50%, -100%) with left = box.left + box.width / 2, top = box.bottom reproduces the clamped box exactly, and .lf-addresses is position: fixed; inset: 0, so documentElement.clientWidth/Height share the chip rects' coordinate space (and correctly exclude the scrollbar, where innerWidth would not).
  • The pass stays at one layout: measured is materialised by .map before any write, and the loop only writes afterwards.
  • .lf-in survives its other two owners (.lf-targets > .lf-target-hint.lf-in, .lf-legend-box.lf-in), so removing the address rule leaves nothing dangling.

Refuted:

  • Specificity regression from :is(…, body[data-lf-goto] *). The :is() now takes (0,1,1) from its most specific argument rather than (0,1,0), but the dense override lf-toc[data-lf-dense] .lf-toc-nav:hover :is(.lf-toc-start, li):hover a is (0,5,2) against the goto rule's (0,3,3), so it still wins — in the base block and in the reduced-motion one.
  • data-lf-goto stranded on a disarm path. Every call site in address.js and dispatch.js goes through setChord, and the refusal branch returns before chordArmed is written, so the attribute and the flag can't diverge.
  • Zero-height key line judged against a chip. Real on main, not reachable here, for the clamp reason above.

Not raised, already tracked: docs/example-release-notes.jpg now lags a fourth edit to the paragraph this PR rewrites, which is #176 — release-notes is the instance that issue already leads with.

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

Nothing to raise on the merge: the resolution takes the right side everywhere I checked, and the #209 collision I flagged last time is settled the safe way. It keeps this branch's unguarded const kept = [keylineEl.getBoundingClientRect()] and drops #209's lineBox.height ? [lineBox] : [], which holds here because box.left is Math.max(0, …), so overlaps would need box.left < 0 to match the origin rect a display: none key line leaves. The guard survives in surface.js's bottomEdge (keyline.height && left < keyline.right …), where it is still load-bearing.

Worth knowing separately: the two test reconciliations in the merge are fixes for a red main, not adjustments to this branch. main currently fails test_a_margin_table_of_contents_maps_the_document_until_the_reader_enters_it and test_a_row_stands_the_reader_on_the_control_that_answers_it — #209 added @media print { lf-toc .lf-toc-start { display: block; } } and the banner_address helper without updating those two call sites in tests/test_render_widgets.py. Both are nightly-marked and ci.yaml runs the nightly suite only on push to main, so #209's own PR run could not see them. This merge's to_be_visible() and banner_address(page, ".lf-decisions") are exactly the repair, so landing this clears the red — before tend-ci-fix derives the same two fixes on its own. 03152f7 does not touch either.

Reproduction

A worktree at 2787711 (this PR's base, #209's merge into main), Chrome on ubuntu-24.04:

$ uv run --frozen pytest tests/test_render_widgets.py -q -n0 -k margin_table_of_contents -x
>       expect(start).to_be_hidden()
E       AssertionError: Locator expected to be hidden
E       Actual value: visible
    tests/test_render_widgets.py:597

$ uv run --frozen pytest tests/test_render_widgets.py -q -n0 -k row_stands_the_reader -x
    locator resolved to <button data-lf-seat="4" … class="lf-btn lf-decisions lf-news-shown">Asks (4)</button>
    56 × waiting for element to be visible, enabled and stable
       - element is not visible

The same two on this head, plus the go-to cases, pass:

$ uv run --frozen pytest tests/test_render_widgets.py tests/test_render_navigation.py -q -n0 \
    -k "row_stands_the_reader or addresses_fit_the_visible_screen or no_address_is_drawn or g_chord_reaches"
5 passed, 144 deselected
$ uv run --frozen pytest tests/test_render_widgets.py -q -n0 -k margin_table_of_contents
1 passed, 76 deselected

Also checked on the merged tree: scripts/corpus.py reproduces examples/corpus.html byte for byte, so the hand-resolved lede is in sync; data-lf-goto is written only by setChord and read only by CSS, so the paint attribute adds no second source for chordArmed; and in dense margin form the chord reveals nothing, which is what :focus-within already did there.

@max-sixty
max-sixty merged commit 895f160 into main Sep 2, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/goto-hints branch September 2, 2026 07:27
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