Repository navigation
Show when a live sample holds the user's keys - #3976
Merged
Merged
Conversation
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]>
leaf-agent
approved these changes
Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
cwould 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'sblur), 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.jshands it to a newinputInFrameinfocus.js. A press there puts the user on the frame as a Tab would, andreconcilenow 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-visibleon its host, sopaintFocusapplies 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_samplecovers 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.