Repository navigation
Land a press on a tab panel's contents where it would land without the panel's stop - #6353
Merged
Merged
Conversation
…e panel's stop
The open tab panel takes tabindex=0 so the keyboard can reach and scroll it, and the
browser focuses the nearest focusable box around a press. So a click on a panel's words
or empty space focused the panel, with no ring, and `c` then commented on the whole tab
("Comment on tab · #6312 …") where a plain page gives "Comment on the page".
focus.js now passes that focus on at the release: to the nearest other box around the
panel that a press focuses, or nowhere. Until the release, DOM focus stays on the panel
so a drag still selects, while `focused()`, holds and the focus paint read where the
press will land. The same holds when the keyboard had put the user on the panel, and
when the pressed control takes no focus of its own (a button in WebKit). A tap, whose
focus arrives at its click, passes a task later so Chromium keeps its caret. A key or
placement during the press takes over. WebKit's dropped caret is put back.
Reach's lent stop on an overflowing box keeps its press focus: a diff's or a code
block's scrollport wears it, and a click on a widget's contents is what puts the user
in its keys.
Measured with `leaf-dev probe` on a copy of the needs-me queue page, base against head,
in Chromium and Firefox: click on empty space or words then `c` went from "Comment on
tab" to "Comment on the page"; a drag still comments on the selection; PageDown and `d`
still scroll the panel (588 px, 444 px); Tab onto the panel then `c` still comments on
the tab. In WebKit a button press in a panel now gives a page comment too, and Chromium
touch taps keep the caret and PageDown.
leaf-agent
approved these changes
Nov 18, 2026
This was referenced Nov 18, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 18, 2026
) #6353 changed where a press on an open tab panel's contents lands. It now goes to the nearest other focusable box around the panel, or nowhere, instead of focusing the panel through its `tabindex=0`. `test_a_preview_leaves_a_region_the_user_works_in_reachable[panel-*]` still proved that the press reached the panel by expecting the panel to take focus. It failed on main in push run [44269587200](https://github.com/max-sixty/leaf/actions/runs/44269587200), in Chromium and Firefox, with `#region` inactive. The test checks that a margin preview doesn't cover a region the user works in. For the panel case it now checks that the click itself landed on `#region`. A preview covering that point would have received the click, so the check still fails in that case. The code and frame cases keep their focus checks, since #6353 leaves both alone: the code is a scroll stop Leaf lends, and the frame's field takes focus. Only the test changes, and #6353's behavior stays as its author intended. Verification: both panel cases fail on main locally with the CI message. All six cases of the test pass on this branch. Refs #3985 — automated triage Co-authored-by: leaf-agent <[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.
A click on empty space or words in an open tab panel focused the panel, because its
tabindex=0makes it click-focusable.cthen commented on the whole tab ("Comment on tab · #6312 …"), and no ring showed it. Now the press lands where it would without the panel's stop: on the nearest other focusable box around the panel, or nowhere. Socgives "Comment on the page", as it does on a plain page. Tabbing onto the panel still puts the user on it.Worth weighing:
focused(), holds and the focus paint read where the press will land.ccomment on the table, at widths where the table overflows.Max asked for this on a Leaf page. Codex and a fresh Claude Code agent each reviewed it.
Tests:
focus.test.mjscases cover each route.leaf-dev probe, base against head: Chromium, Firefox and WebKit, plus Chromium touch.