Skip to content

Hint every visible control in Go-to, Leaf's own included, by one rule over the whole document - #7332

Merged
max-sixty merged 7 commits into
mainfrom
go-to-hints-leaf-controls
Nov 27, 2026
Merged

max-sixty merged 7 commits into
mainfrom
go-to-hints-leaf-controls

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Go-to (g) now gives a hint to every visible control, whoever drew it: the page's, a widget's, and Leaf's own, such as the floating panel's tabs, rows, search, Close and leaf, and a thread card's Edit, Copy, Resolve and microphone. Its readers (links, tabs, summaries, offered presses) read the whole document rather than only the page's content, and Leaf's surfaces join by building their controls the usual way, so no list of surfaces exists. A chip naming a panel control may stand on the panel (each chip keeps clear of the chrome but for its own target's surface).

To weigh:

  • A control whose press runs one of Go-to's own destinations wears that destination's key rather than a generated letter: On Me's tab M, On 's A, Threads' T while another view shows, the menu's Versions V and Hide annotations H. A control says which command it runs (data-lf-command, which the command reference's rows already carried), so no list names them. Page-control rows name their command in place of a commandSteps shortcut, and a row with no shortcut of its own now shows its command's keys, so Hide annotations shows g H as Versions shows g V. Keys outside Go-to's grammar, as Fold's ., don't replace letters.
  • Each Go-to chip now hangs on the corner of what its target draws (drawnBox), its words or glyph, rather than on its padded box, whose corner put a tab's or icon's chip nearer its neighbour. Page links don't move; a page button's or margin entry's chip moves onto its label.
  • Transparent controls, such as a message's Edit before hover, get no chip. So the map is read once the frame arming paints is drawn, and chips show from that reading with codes that don't change: about 33 ms after g, or, while one panel view replaces another, once the arriving view's delayed fade has played (within 150 ms; heldUnseen in dom/motion.js). By then a panel view or card that was fading in shows, and a decision's picks are out from under their digits, so both are counted. The comment target picker shares the hint session, so its chips wait the same way.
  • The ✕ beside "Go to" and the field's Close get no chip, since both only end Go-to (heldByStance).
  • Role-faced copy controls now take Go-to's press. Their look doesn't change, since the host leaves the aim floor to the reach its button part already has.
  • No package-interface names are added. pageParts and the hintChrome option are gone.

Max asked for this from a Leaf page. A code review and a fresh render review checked it, and their findings are folded in. Tests: pnpm run test:runtime and the Go-to, picker and copy browser tests selected by -k.

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

Go-to's target readers (links, tabs, summaries and the presses Leaf's control
constructors mark) read the whole document instead of only the page's content, so
the floating panel's tabs, rows, Close and leaf, a thread card's presses and a
dialog's controls take hints as the page's do. Before, with Threads open, Go-to
said "No visible targets" over a panel full of controls.

Two cases are left out. The panel's ✕ and the field's Close while a stance holds
the row only end Go-to, so the panel says which of its parts a stance holds
(`heldByStance`), which holds from the task that arms Go-to, before the row redraws.
A transparent control, such as a message's Add reaction before hover, still takes a
click but shows nothing, so members now pass `checkVisibility` with
`opacityProperty`; the contents map's labels, which Go-to reveals, now show at once
under it rather than fading in after the map is read.

Each chip keeps clear of the chrome except the surface its own target stands on
(`coverBoxes(member)`), so a chip naming a panel control stands on the panel. The
seating pass takes barriers per face.

Tests that counted a page's chips count them by kind, since the panel's leaf now
holds a chip on every page. `pageParts` had no other caller and goes.
…ttles, and let copy controls take Go-to's press

Reviews of the first commit found three ways Leaf's own controls still failed the request.

A chip read as a neighbour's. Go-to hung each chip on its target box's corner, and
Leaf's tabs, icon buttons and thread rows begin in padding nobody sees: the On Me tab's
chip stood in the gap after Menu's label, a thread row's on the line between two rows,
and the leaf's beside the stance's ✕. Each chip now hangs on the corner of what its
target draws inside that box, its words or glyph (dom/geometry.js, `drawnBox`), so it
stands on its own label. A page link's chip doesn't move, since a link's box is its
words; a page button's or a margin entry's moves onto its label or glyph.
`reading-place.js`'s `draws` moves to lib/shown-box.js, its one home for both readers.

The map missed controls that were fading in. Go-to read its map once, in the keydown
that arms it, and since the first commit leaves out transparent controls, `g T g` typed
at once missed the panel's tabs and leaf (the browser test passed only through a
resize), a thread card opened just before `g` lost all its controls, and on a decision
each option's pick, transparent under its digit until arming takes the digits away,
lost its chip, which base gave it. The map is now read again once the scene arming
draws has been drawn and every finite fade under way has ended (hints.js, `arm`); the
arming words wait for that reading, unless the user has typed or walked meanwhile.

Copy controls had no chip. Web Awesome copies on a click of the button it draws inside
the copy host, so the host declared no press. A role-faced copy control now passes a
click on its host to that button and opts into the press contract (lib/controls.js,
`offerActionElement`'s `pressable`), so the card's Copy and Copy link, and a code
block's Copy, wear chips whose code copies. The host now also takes the theme's
pressable rule: the hand, and the 24px aim floor its sibling icon buttons already had,
which widens a code block's bar a little.

The hint session reads the chrome's covers itself (`coverBoxes`) rather than through a
`hintChrome` option leaf.js built for both maps.

Tests: the chrome test drops its resize and checks each tab's chip stands inside its
tab; new tests cover a decision's picks keeping their chips and a code block's Copy
copying by its code. The walk helper waits for the map's own words before walking, and
reads routes that end in their own punctuation.
… leave a copy host's floors to its part's reach

Review of the previous commit found three defects.

The arming wait could hold Go-to's words without bound. It waited for every finite
opacity animation in the document: a page's own 12 s pulse held "Go to — N visible
targets" for 12 s, and a pulse the pointer paused held it, and the map's second
reading, for good. The wait is now only for the frame after arming to be drawn
(`armingDrawn`). That is enough, since a control fading in is past opacity 0 by then,
and checkVisibility counts only 0 as transparent. So the contents map's labels need no
`transition: none` under Go-to, and toc.css is back as main has it.

Codes visibly changed after arming. The chips painted from the instant reading and were
recoded about two frames later. Now no chip shows until the arming frame is drawn, as
none shows on a page in flight (`paint`). Chips appear about 33 ms after `g`, with the
codes they keep.

A code block's Copy overhung its block on a phone. As a press, the copy host took the
44px aim floor while its place was still worked out from its 24px box. The copy host
now leaves both floors to the reach its button part already hangs (surfaces.css), so
it draws as main does at every size. It keeps the hand cursor.

Tests: hint-session cases await `arm`, which now returns once the arming frame is
drawn.
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026

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

The new wait also reaches the target picker. createHintSession now hides chips until armingDrawn settles (reading !== null counts as moving in paint), so the picker's chips also show about two frames after it arms, and its spoken count is dropped once a letter has been typed. The description gives this trade only for Go-to. If the picker should keep its first-frame chips, the wait belongs to Go-to's options rather than to the shared session. Otherwise it's worth a line in the description, since that becomes main's commit message.

A panel view replacing another stays at opacity 0 until the leaving view has
faded out, so Go-to armed in that window read the map without the arriving
view's controls, and read it again about 45 ms later with every code changed
(Threads open, then g M g). dom/motion.js now answers when the parts its
delayed motion holds unseen show (heldUnseen), and the hint session's arming
waits for it, about 150 ms at most. Page animations aren't counted, so they
never hold the map. The target picker shares the session and waits the same way.

The new test slows animations to a tenth through CDP so Go-to arms inside the
swap; it fails without the wait (two code sets) and passes with it.
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026
The live region can still hold the words of the Go-to the test armed first to
open On Me, so the walk must wait for the second map's chips, as the other
Go-to tests do; on CI it read the stale words and walked no chips.
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026
With Go-to armed, the floating panel's On Me tab wore a generated letter though `g M`
already opens On Me. A control now says which command its press runs
(`data-lf-command`, as the command reference's rows already do), and a target whose
command is one of Go-to's named destinations wears that destination's key instead of
a generated letter: On Me's tab M, On <agent>'s A, Threads' T while another view shows,
the menu's Versions row V and Hide annotations H. The rest share the generated
letters as before. The key is read from the destination's declaration, so a re-read
mid-route recodes nothing.

Page-control rows name their `command`; the three that spelled their shortcut as
`commandSteps` of a command now name the command and the menu derives the steps, so a
row with no shortcut of its own, as Hide annotations, now shows `g H` like Versions'
`g V`.

Asked for on the Go-to handoff page: "we actually have `g M` which always goes to On
Me; we want to prioritize that".
@max-sixty
max-sixty merged commit 854c587 into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the go-to-hints-leaf-controls branch November 27, 2026 06:05
max-sixty added a commit that referenced this pull request Nov 27, 2026
…ange without motion (#7358)

A Go-to press of a panel tab, a fold with a list open, and a view change
under reduced motion each drew the floating panel more than once in one
task, the earlier draws in states no frame showed. On the Menu tab that
hid and showed the field's mode span, which the write watch fails. Three
changes, one per path:

- The field's writing-posture listener requests a Lit update instead of
painting, so the click that follows Go-to's focus takes the update over.
- The rest preference's setter no longer dispatches
`lf-chrome-preference`. Its one listener painted the new rest beside the
old route, and every caller of the setter already paints.
- `transition()` asks `motionPlays()` before its paint, so a view change
without motion draws once.

A thread's rewrite hold still paints inside the focus move, because a
later listener in the same move measures the held view.

Panel draws per input, main → this branch: Go-to → Menu, 5 → 4 over the
next 300 ms; fold with On Me open, 3 → 2 in its task (4 → 2 with reduced
motion); the Menu tab with reduced motion, 3 → 2.

To weigh: the posture now draws at the end of the script that moved
focus, so code that focuses a panel control and reads the row's posture
in the same script would see the old one. Codex's review found no such
reader.

Max asked for this as an open item on the Go-to hints page after #7332
landed. Tests: `pnpm run test:runtime`, `pnpm run check:browser`, and
`-k` selections of the Go-to, floating-panel, rewrite, key-scope,
On-panel, sending, obligation-walk and threads browser tests. The Go-to
test of the panel's own controls takes the Menu route again, and failed
3 of 3 runs without the fix.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 27, 2026
…y get Go-to hints (#7382)

Go-to gives no hints to the contents spine's links, and
`test_generated_hints_include_links_revealed_by_a_page_widget` has
failed on every `main` run since #7332. This change makes the spine show
its labels at once while Go-to is armed, rather than fading them in, so
they are visible when Go-to reads its map and get their chips again.

**Cause.** #7332 meant every visible control to get a hint and a
transparent one none, so it judges a control with
`checkVisibility({opacityProperty: true})`. Go-to reads that map once
the frame arming paints has been drawn (two frames). The spine's labels
rest at `opacity: 0` and fade to 1 over `0.24s` when
`body[data-lf-go-to-active]` is set. I sampled the label layer every
frame after `g`: its computed opacity was still exactly `0` at 27 ms and
43 ms, when the map is read, and only started rising (0.11) in the frame
after. So every label was judged unseen. Nothing reads the map again
once the fade ends, so the chips never appeared, even after the test's
120 s wait.

**Change.** In `packages/default/styles/toc.css`, the Go-to reveal sets
`transition: none`. Hover and keyboard focus still fade the labels in,
and when Go-to ends they still fade out, since that transition comes
from the resting rule. On screen, the only difference is that pressing
`g` shows the labels at once instead of fading them in over 0.24 s.
Every state still looks as it did before.

**Verification.** Run alone (`uv run pytest -n0 <node-id>`), the test
fails on `main` with 0 of 4 chips and passes with this change. The
spine's disclosure tests and the test for the contents row's marks still
pass.

**Alternative not taken.** Go-to could instead treat a control whose
opacity is transitioning upward as visible, as it already waits for
panel motions held in their delay (`heldUnseen`, `dom/motion.js`). That
would cover any package's reveal. But no other package's styles reveal
anything under `data-lf-go-to-active`, and it would add a second motion
rule to the core's map timing. So the fix stays in the package that owns
the fade.

Closes #7379 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 27, 2026
…y chip (#7414)

`test_the_g_chord_reaches_named_surfaces_and_visible_targets` asserted
that a disclosure summary's Go-to chip sits on the corner of the
summary's box. #7332 deliberately moved every Go-to chip onto the corner
of what its target draws, its words or glyph, rather than its box ("Each
Go-to chip now hangs on the corner of what its target draws
(`drawnBox`)…"). A summary's box begins at its disclosure marker, so the
chip now stands where "What the store costs" begins: measured on Linux,
chip centre at (294.8, 271.7), the words' first line box at (294.8,
271.7), the summary box's corner at (280, 268.7). The code does what
#7332 meant; the assertion is stale.

The test now reads the first line box of the summary's words (a `Range`
over its contents) instead of the summary's first client rect. No
behavior moves, and #7332's intent is kept whole, so no follow-up issue
is needed.

Verified by running the test by node id: it fails on `main` at 6a95224
with the reported message and passes with this change.

Closes #7409 — automated triage

Co-authored-by: leaf-agent <[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