Skip to content

Show when a live sample holds the user's keys - #3976

Merged
max-sixty merged 4 commits into
mainfrom
sample-focus-cue
Oct 25, 2026
Merged

max-sixty merged 4 commits into
mainfrom
sample-focus-cue

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A press into a live sample took the user's keys into the sample's page and showed nothing, so there was no telling whether c would comment on the page or on the sample. The containing page hears no focus event when a press moves focus into a frame (Firefox fires none, Chromium only the window's blur), so its current location never became the frame, and #3807's ring drew only after a Tab. Leaving the frame by a press on the page fires nothing in Firefox either.

Mechanism. The sample child already sends the parent a notice for each input; it now names the input's type, and sample.js hands it to a new inputInFrame in focus.js. A press there puts the user on the frame as a Tab would, and reconcile now takes them off a frame when a press on the page leaves focus nowhere. A key or press in the child also counts as the user's latest input, which decides whether the frame is focus-visible: a frame never matches :focus-visible on its host, so paintFocus applies the platform's rule from the inputs.

Cue. While the frame holds the keys, the sample's gutter takes the focus ring's colour, after a press or a Tab. The ring keeps its meaning everywhere else in Leaf, the keyboard's position, so the frame wears it only when focus-visible. Full view keeps the gutter (27px), since its own buttons share the keys with the sample there. The user picked the gutter from three candidates (a ring on any entry, a coloured frame edge, the gutter). The gutter is a new kind of mark, a region saying it holds the keys, which only a frame needs.

Tests. test_the_gutter_shows_while_keys_go_to_the_sample covers a press in and out, a Tab in, a press inside, a Tab again and Shift+Tab out. It fails without the child's report. The Full view Tab walk checks the gutter beside the ring.

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

max-sixty and others added 4 commits October 25, 2026 09:01
A press into a live sample took the user's keys into its page and showed
nothing: the containing page hears no focus event when a press moves focus
into a frame (Firefox fires none, Chromium only the window's blur), so its
current location never became the frame and #3807's ring drew only on Tab.
The sample runtime now reports each input the child hears to focus.js
(`inputInFrame`), which puts the user on the frame as a Tab would, and a
press back on the page takes them off it, which Firefox also fires nothing
for.

The cue moves from a ring round the frame to the sample's gutter, which takes
the focus ring's colour while the frame is the current location. A ring on
every press would ring the whole sample, and on Tab it doubled the child's
own ring on its control. Full view keeps the gutter, since its own controls
share the keys with the sample there. The full-view Tab test now checks the
gutter, and a new test covers a press in and out and a Tab in and out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The gutter says where the user's keys go; the ring keeps meaning what it
means on every other control, the keyboard's position, so a frame reached by
Tab wears it and one reached by a press does not. A frame never matches
:focus-visible on its host, so focus.js paints its visibility from the inputs
the way the platform does: visible unless a press put the user there, which
`inputInFrame` now records as the user's latest press. This also keeps the
Tab walk's check that every stop shows a ring, which the gutter alone would
have failed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A press inside a sample the user had Tabbed into kept the frame's ring, since
the containing page heard nothing of it. The child now names each input's
type in its notice, and `inputInFrame` takes a key or a press there as the
user's latest input, as the platform's :focus-visible does on any control:
a press drops the ring and a key brings it back. The gutter test covers the
Tab, press and Tab again.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 3ba8206 into main Oct 25, 2026
4 checks passed
@max-sixty
max-sixty deleted the sample-focus-cue branch October 25, 2026 16:41
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