Repository navigation
Show focus on a live sample iframe - #3807
Merged
Merged
Conversation
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
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_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Give a live sample iframe a visible focus ring when Tab enters it. The sandboxed iframe receives keyboard focus, but the browser does not match
:focusor:focus-visibleon its host in this case. Leaf's focus runtime already marks the host withdata-lf-focus; the sample stylesheet now draws the ring from that mark.The focused full-view sample Tab test failed without the style rule (
outline-style: none) and passes with it.pnpm run check:browserandgit diff --checkpass. This addresses the unindicated sample frame found while investigating the October 24 nightly run; that run has other independent failures.