Skip to content

Seat each key hint only where it reads as its own target's, hold seats while the map narrows, and give a diff's line numbers no Go-to chip - #5845

Merged
max-sixty merged 8 commits into
mainfrom
diff-key-hints
Nov 12, 2026
Merged

max-sixty merged 8 commits into
mainfrom
diff-key-hints

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Generated key hints (Go-to g, target picker s) were never dropped: a chip that collided slid up or down to the nearest free spot however far, so it could stand beside a different target, and typing its code acts on the one it names. In a list of 24 links at 14px rows, row 13's chip stood beside row 18; in the PR walkthrough, a file row showing 3px under the floating panel had its chip pushed 57px up beside another file's row.

Now a chip moves only to seats where it still reads as its own target's (within one chip slot of its rows, with no other target in its column nearer). Where rows are shorter than a chip, each corner chip stands level with its row and every other one a column further left, each column left-aligned at the width of its widest chip; against the window's edge every other row's chip is withheld. A chip with no admissible seat is withheld, while Tab and its code still reach its member, and a walk onto it shows it. Seats belong to the whole map: a typed letter, a Go-to kind filter (g h/f/m/t, now the session's kept narrowing) and a walk only hide chips, so nothing the user is reading moves as they type, and a filtered map is seated against every target. Go-to also gives no chip to the gutter role, a diff's line numbers, since the target picker already comments on lines and a chip per line buried the file rows' routes.

To weigh: this reverses the recorded "every chip stays visible" decision (hints.js header).

Asked by max-sixty. Tests: hint-seating.test.mjs (dense column with and without room, edge clamp, row under the panel, footnote stack, mixed code widths, walk onto a withheld row), test_go_to.py (a diff's Go-to, narrowing by letter and filter moves no chip), plus the go-to/picker browser tests that read chip positions.

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

…a diff's line numbers no Go-to chip

Generated hint chips (Go-to `g` and the target picker `s`) were never dropped: a chip
that collided moved up or down to the nearest free top, however far. In a column of
rows shorter than a chip and its gap, the error grew down the column. In a list of 24
links at 14px rows, row 13's chip stood beside row 18 and the last chips trailed 150px
below the list. A file row showing 3px under the floating panel had its chip pushed
57px up, beside another file's row. Typing such a chip's code acts on the target it
names, not the one it stands beside.

`seatHints` now admits a seat moved off its placement's seat, by other chips or by the
window's edge, only where it still reads as its own target's: within one chip slot
above or below the target's rows, with no other target in the same column nearer the
chip's middle. The hint session passes every target the map holds, read with no prefix
typed and kept while a prefix freezes the map, so a typed letter can't seat a chip
beside a member whose chip it put away and still lays out only the chips it keeps.

Where two rows' corner chips would collide, as in a list of rows shorter than a chip,
each chip stands level with its own row instead of on its corner, and a chip whose
level seat is taken steps one or two columns left. A dense list so keeps one chip per
row in two columns; against the window's left edge every other row's chip is withheld.
Chips crowded side by side, as adjacent footnote markers', still stack above and below.
An outside seat that can't keep off its own target stands on it, as before. A chip with
no admissible seat is withheld, hidden while its code and the Tab walk still reach its
member, and the browsed chip is seated first. This reverses the recorded decision that
every chip stays visible; hints.js's header records the change.

Go-to no longer gives a chip to presses with the `gutter` role, a diff's line numbers:
commenting on a line is the target picker's, and a chip on every line buried the
file's own routes. Each file keeps its fold and Comment chips.

The Go-to kind filters (`g h`, `g f`, `g m`, `g t`) still pass only their own members
as targets, so a filtered map can seat a chip beside a visible target of another kind,
as it could before.

Tests: tests/runtime/hint-seating.test.mjs covers the dense column with and without
room beside it, the edge-clamped row, the row under the panel, footnote stacking and a
target filling the window. test_go_to.py checks a diff's Go-to map, and
test_generated_hints_fit_the_visible_screen now expects the link under the panel's band
to have its chip withheld and its code still to work.
…ole map again when a kept target moves

A typed prefix put a row's chip away and with it the crowded-row check that kept its neighbours level, so they jumped back to their corners straddling the row whose chip was gone. The check now reads the scene's targets. The whole map's targets, kept while a prefix is typed, are read again when a kept target has moved, as a revision reflowing the page moves it.

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

One regression in the Tab walk: in a crowded list, each Tab now moves most of the map's chips to a different column (inline).

Comment thread browser/runtime/keyboard/hints.js Resolved
Seating it first on every paint changed the greedy order on each Tab, so in a
crowded column with room to step out, 10 to 14 of 24 chips changed column as the
walk moved between rows. Now the map is seated in page order, and again with the
browsed chip first only when that withheld it, as at the window's edge.

Behaviour change: a Tab walk no longer moves any chip where every chip already
has a seat.
leaf-agent
leaf-agent previously approved these changes Nov 11, 2026
Chips centre on their row's corner, so in a crowded list where codes grow from
one letter to two, the two-letter chips started further left and the column a
step out moved with them: four left edges where two columns stood. Each crowded
column now takes the width of its widest chip, and every chip in it starts at
that column's left edge, so the list shows two straight edges.

Behaviour change: in a crowded column of mixed code lengths, one-letter chips
move left to the column's edge and the outer column steps out by the widest
chip.
leaf-agent
leaf-agent previously approved these changes Nov 12, 2026
… chips

A typed letter re-seated only the chips it kept, so in a crowded column every
kept chip swapped columns as the user typed (11 of 11 on the 24-row probe). A
Go-to kind filter re-read the scene as its own smaller map and seated against
its own members only, so a filtered column of folds stood on its rows'
corners, half over the links between them (12 of 12 moved).

Both are one cause: seats were computed from the narrowed map. Seats now
belong to the whole map. A paint that seats chips seats every member's, and a
typed letter, a filter (the session's new `kept`, which Go-to's filters set)
and a walk hold the seats, only hiding what they rule out; a new reading, a
settled scroll, a resize or an invalidation seats the whole map again. This
deletes the scene-target cache a prefix kept and seatHints' `targets`
option, and the session's `refresh` gives way to `narrow`.

chip-seats.place now removes the nodes of seats it puts away, which a seat
drawn only to be measured would otherwise leave standing.

Behaviour change: narrowing the map moves no chip; tests that count the map
the user sees after narrowing count :visible chips, since ruled-out chips keep
their seats hidden.
@max-sixty max-sixty changed the title Seat each key hint only where it reads as its own target's, and give a diff's line numbers no Go-to chip Seat each key hint only where it reads as its own target's, hold seats while the map narrows, and give a diff's line numbers no Go-to chip Nov 12, 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 test job's pnpm run check fails on this head: tsc reports browser/runtime/keyboard/hints.js(746,58): error TS2532: Object is possibly 'undefined' (job). Under noUncheckedIndexedAccess, plans[index] in the new draw filter has type T | undefined. The suggestion inline passes tsc --project browser/types/tsconfig.json and Prettier locally. The rest of the push is sound: the whole map is seated once and narrowing hides chips without moving them, which replaces the targets/sceneTargets machinery.

Comment thread browser/runtime/keyboard/hints.js Resolved
…ember's chip

Review of the narrowing change found the held seats too sticky: a layout that
moved a target left its chip where it stood, and a heard target that lost its
chip kept the walk and its Enter. The seats now stand only while every shown
chip's target and the chrome's barriers are where they were measured, and a
held paint retires a walk whose chip no longer shows.

draw now seats every member's chip whatever the character routes show, so the
one chip a walk shows with no character routes is seated against every
target, and places only the seats of chips that show. The members a filter
keeps are taken once per reading or filter rather than on every keystroke.
Fixes the type error in the draw filter that failed CI.
leaf-agent
leaf-agent previously approved these changes Nov 12, 2026
A held paint compared only the shown chips' targets, so a target a filter or
the character routes hid could move under a shown chip's seat and leave it
beside that target. Every paint now lays out the whole map, as an unnarrowed
paint already did, and the seats stand only while every member's target and
the chrome's barriers are where they were measured. The scroll hold and the
held paint share one path.
@max-sixty
max-sixty merged commit c5739b8 into main Nov 12, 2026
5 checks passed
@max-sixty
max-sixty deleted the diff-key-hints branch November 12, 2026 06:29
leaf-agent added a commit that referenced this pull request Nov 12, 2026
…-read (#5867)

Since #5845, Go-to reads every visible target and its filter narrows
that reading through `kept`. The rows that depend on the map (Tab,
Shift+Tab, Enter, and the filter's "No visible …" status) read the
narrowed members, but `paint()` still decided whether those rows needed
repainting by whether the *whole* reading was empty. So with a filter
active, a scroll that moved every matching target out of view while
other targets stayed left Tab and Enter offered and the "No visible …"
status unshown until some unrelated repaint, and scrolling matches back
in left the rows missing the same way. `paint()` now compares the
filtered members on both sides
([`hints.js`](https://github.com/max-sixty/leaf/blob/3ff38d97df81324e667aeb959f6e71140b6e65eb/browser/runtime/keyboard/hints.js#L829)).

The new case in `tests/runtime/hint-session.test.mjs` arms a filtered
map, re-reads it empty and then refilled, and checks that each re-read
asks for a repaint. It fails on `main` (`no repaint after the map read
one`) and passes here. `hint-session`, `hint-seating` and `go-to-keys`
pass, as does the browser type check.

The commit also fixes two comments: `passages.js` pointed at `readPage`,
which #5570 split into `collect` and `indexed`, and
`createHintSession`'s header gave a reason for members carrying their
codes that no caller has any more.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 13, 2026
…ws the map (#5922)

#5845 changed how the target picker narrows: a typed letter now hides
the chips it rules out (`visibility: hidden` in
`browser/runtime/keyboard/chip-seats.js`) and leaves them in the DOM, so
no chip the user is reading moves as they type. That PR updated
`test_go_to.py` and the hint-seating runtime tests to read only shown
chips, but not two picker tests in
`tests/browser/test_render_semantic_selection.py`. Those tests still
counted every `.lf-target-picker-hint` after the first key of a two-key
code, so they saw 61 and 32 where 11 and 7 chips are shown. Every `ci`
push run on main has failed on them since `b3387f111`.

Both tests now count chips matching `:visible` against the codes shown
before the letter. What they protect is unchanged: a prefix narrows the
map to the codes that begin with it, the continued chip marks its first
key as pressed, and the full code still acts. The runtime is unchanged.
This only aligns the tests with the behavior #5845 chose.

Locally, both tests fail on main with the counts above and pass with
this change.

Closes #5915 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 14, 2026
…rawing's HTML where Chromium can't anchor it (#5897)

A survey of every example, gallery and docs page (45), at three window
sizes and up to five scroll positions, in Go-to (`g`) and the target
picker (`s`), found two key-chip defects that #5845 left. This fixes
both.

**A picker chip stood on its neighbour.** A picker chip stands before
its target, and where targets sit side by side, as cards in a row,
buttons or a film's slots, that seat is on the target to the left, so
the chip read as that one's. `seatHints` now judges every seat a chip
may take by one test, `readsAs`: the chip stands within a chip's height
of its own target; off its own target, no other target stands between
the chip's middle and the nearest point of its own; and no target in its
column, or in its own target's, has rows nearer its middle. Each
placement offers its seats in order, before then above for an owner and
above then before for a control, and a chip whose outside seats both
fail stands on its own target's corner, as a Go-to chip does. This
replaces the split between `coversAnother` and `readsAs`, the
corner-height fallback (`levelTop`) and the unused `below` placement.
Chips level with each other also stand at least 6px apart: a code draws
each letter as its own keycap 1px from the next, so touching two-letter
chips read as single letters (`na` `ng` as `n a n g`). A target narrower
than a keycap, with another as narrow beside it on its line, gets no
chip, since no seat beside it says which of the run it names; its code
still takes it and a walk onto it shows its chip. Across the 45 pages,
picker chips standing on another target fell from 184 on main to 1, and
eight of Go-to's 2,768 chips moved.

To weigh: 96 more picker chips than on main are withheld (hidden until
Tab reaches them), 80 of them every slot of rust-sort's film in the two
smaller windows, whose 13px slots fall under the narrow-run rule; the
user judged those too small and bunched to be worth chips. The
narrow-run rule matches nothing else in the survey: contents lists stack
their rows one under another, and no Go-to target qualifies. It would
also withhold adjacent footnote markers' chips, which were stacked
around the markers; no shipped page has them, and the crowded fixture's
test now checks they keep their codes. And 27 more chips overlap another
target at their edge though their middle stands clear, 14 of them
two-letter chips on rust-sort's film at 1440px, which overhang the next
slot. The user chose the gap over drawing a code as one keycap, which
would lose the pressed face of its first typed letter. A nearest-target
test (distance from the chip's middle to each target) was tried first
and read worse: it counts a card's edge across a gutter as nearer than
the choice beside it, and moved gutter chips onto radio buttons and
headings. In a blind review of 14 changed views, an earlier form of this
test was ranked best in 6 and worst in 4, against 4 and 5 for the
survey's first fix. `nearestOpenTop` tries only the preferred top, the
window's edges and each barrier's edges, so a chip clamped at the
window's edge can be withheld where a lower top would read as its own;
before this change that chip stood on the other target. Stills are on
the Leaf page.

**A chip for an element inside an SVG `<foreignObject>` stood at
-9999px.** Chromium resolves no `anchor()` to such an element (Firefox
and WebKit do), so wt-merge's Go-to chip for its terminal line was off
the window while its code still worked; review reproduced a margin row
there at -9999px too. `anchorElement` now anchors any element in a
`foreignObject` through the drawing's `<svg>`, which every engine
resolves, as it already did the drawing's own shapes, with insets
measured from the drawing. It climbs the rendered tree, so a drawing
inside a shadow tree counts too, and asks whether the document can name
the drawing rather than the element inside it. A scroller inside a
drawing's HTML doesn't move the drawing, so a mark there stays put while
it scrolls until it is placed again; no shipped page does that. The gap
is recorded in `notes/browser-support.md`.

The user asked for the survey as a follow-up to #5845, and for the
single test after it; Codex reviewed the test twice. Tests: runtime
suite, `check:browser`, a new Go-to test for the foreignObject chip
(fails without the fix), seating cases for the gutter, a
pixel-overlapped corner, a crowded column's chip stepping past a narrow
neighbour, the 6px gap and a narrow run against stacked narrow rows
(each fails with its rule removed), and the picker and Go-to browser
tests.

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

2 participants