Repository navigation
Keep a focus ring's room at a bounded block's foot for controls inside Web Awesome - #5432
Merged
Merged
Conversation
…e Web Awesome Tab onto a control at the foot or top of a bounded block now shows its whole focus ring when the control holds focus inside a Web Awesome control's own tree: a diff's file filter, a package's wa-select or wa-slider, and a code block's Copy. Before, the filter, select and slider landed with the foot of their ring past the block's edge, under the block's "more below" fade. Two rules read where focus is with selectors that stop at a shadow boundary. The landing room, `:where(:focus, [data-lf-focus])` in surfaces.css, now also matches `::part(lf-focus)`, the part name focus.js already gives a focused node in a shadow tree, so the browser's focus reveal and landing-scroll.js read the room there; Copy's own scroll-margin rule goes. The fade in controls.css lifted on `:has([data-lf-focus])`, which can't see into a shadow tree, and now lifts on `[data-lf-focus-within]`, which focus.js sets on every ancestor up through the host. Measured in Chromium 156 and Firefox 157, Tab from 3px past the foot: the filter goes from -3.6/-4.0px of room to +6.4/+6.0, the select from -5.8/-6.2 to +0.2/+0.8, the slider from -5.0/-5.4 to +1.0/+0.6. test_a_key_onto_a_control_at_a_scrollers_edge_shows_its_ring gains the filter in both engines and asserts the block doesn't fade the ring; each of the two rules taken back alone fails it. notes/focus-ring-room.md now covers the case that remains, a ring against a bounded block's side, with its measurements, three candidates and a reproduction. Part of #4125 Co-Authored-By: Claude <[email protected]>
…n a shadow tree Both fades read focus through `:has([data-lf-focus])`, which can't see into a shadow tree. With a wa-select focused in a scrolled row-named table, the previous commit lifted the table's mask and left the row-name fade over the columns, though that rule's comment says it goes as the mask does. A thread card's top fade had the same check. Both now read `[data-lf-focus-within]`, as the scroller's fade does. Probed on the merge base and this tree in Chromium 156 and Firefox 157: the row-name fade with a wa-select focused in a scrolled table, and a card's top fade with a control in a shadow tree in its transcript, each stay on the base and lift here. test_a_scrolling_table_keeps_its_row_names_in_view now asserts the table's mask and the row-name fade both go, and fails with the old check. Part of #4125 Co-Authored-By: Claude <[email protected]>
max-sixty
marked this pull request as ready for review
November 5, 2026 09:22
leaf-agent
approved these changes
Nov 5, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
…ow the window (#5496) Since #5361, a diff file's Comment opens a floating comment box, not its inline box at the end of the file, whenever the file's end is below the window. #5361 replaced `seatFab`'s question "does a panel stand over this seat?" (`underOccluder`) with "does the user see this seat?" (`seenRect`). Its intent was one way to answer "is this in front of the user", and its list of visible changes doesn't include comment boxes. `seenRect` also cuts at the window's top and bottom, so a seat that is only scrolled out of view now counts as unseen too. In `pr-walkthrough`, once `]` opens a file's hunk, that file's thread outlet sits at y≈914 in a 900px window. The inline seat is refused and the box opens floating. That is the failure `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` reports (`#pr-exact-patch .lf-diff-file-comment did not open an inline response`). `seatFab` now refuses a seat only where the chrome covers it (`covered`, the same cover rule `seenRect` cuts with). A seat under the floating panel's room still sends the box to its home, as #5361 intended. A seat that is only scrolled away takes the box, and the field's focus scrolls it into view, which is what happened before #5361. One behavior moves further than a plain revert would: a seat the chrome covers *in part* is now refused too, where `seenRect` accepted any visible part. A box whose seat is half under the panel opens at its home rather than half hidden. Seats inside the panel itself are unaffected, since `coverBoxes` skips the cover that holds them. On screen, in the new `leaf-dev stills --state diff-file-comment` (pr-walkthrough's longest file opened beneath the window's top, then its Comment pressed, 1440×900): on main the box opens floating over the contents column, away from the file; with this change it opens in the file's thread at the file's end, scrolled into view under the file's pinned header. | main | this PR | | --- | --- | |  |  | Verification: - New `test_a_file_s_comment_opens_inline_where_the_file_ends_below_the_window` (`tests/browser/widgets/test_diffs.py`): an 80-line file in a 1200×700 window. On main, no inline composer opens. With the change, the inline composer opens, its field takes focus and is in the viewport. - Ran the ring journey restricted to `pr-walkthrough`. On main it fails with the reported assertion. With the change, every `pr-walkthrough` scope opens its surface with no ring faults. The only remaining failure is the check that other examples' scopes were reached, which the one-page restriction drops. - `pnpm run test:runtime` (816 pass) and `pnpm run check:framework` pass. Three `tests/browser/test_render_diff_controls.py` tests (`test_file_tree_lands_at_the_file_start_after_reading_down[document,pane]`, `test_an_expanded_diff_file_can_retry_its_failed_chunk_in_place`) fail the same way on unmodified main `018fc2587`, so this change doesn't cause them. This fixes the failure the issue currently reports. The earlier scheduled runs' ring faults (`lf-ask.lf-projected-location` rings 5px past the window, runs 41816958231 and 41622727492, both before #5361) are a separate cause that #5432 bears on. So this PR refers to the issue and doesn't close it. Refs #5459 — 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.
Tab onto a control at the foot or top of a bounded block now shows its whole focus ring, for a control that holds focus inside a Web Awesome control's own tree too: a diff's file filter, a package's
wa-selectorwa-slider, and a code block's Copy. Before this change, the filter, the select and the slider landed with the foot of their ring past the block's edge, and the block's "more below" fade lay over what was left.This reduces #4125 to the case that remains, rings against a bounded block's side, which waits on a decision.
notes/focus-ring-room.mdnow covers only that case.The cause
Leaf's sheets read where focus is with selectors that don't reach into a shadow tree, in two kinds of rule:
:where(:focus, [data-lf-focus])gives the focused boxscroll-margin: var(--focus-ring-landing), which the browser's focus reveal and Leaf's landing (landing-scroll.js) both read. A vendor control's focused node is in its own tree, where neither selector matches. The browser then revealed it flush with the block's edge, and the ring's room landed outside. Copy had its ownscroll-marginrule on::part(button)for this reason (Stand a code block's lone Copy on its top border, as a one-mark toolbar #3916).:has([data-lf-focus]).:has()doesn't look into a shadow tree, so the block kept fading over the filter's ring. A table's row-name fade (reading.css) and a thread card's top fade (annotation-chrome.css) used the same check.focus.jsalready marks the focus path on both sides of a shadow boundary:data-lf-focus-withinon every ancestor, the host included, andlf-focusas a part name on a focused node that has apart. So the fix reads those marks:::part(lf-focus)(surfaces.css), which weighs a pseudo-element where the rule it joins weighs nothing. Copy's own rule goes.[data-lf-focus-within]rather than:is([data-lf-focus], :has([data-lf-focus])). The comment on the row-name fade already says it goes as the mask does, and with awa-selectfocused in a scrolled row-named table both now lift, where neither did on main.The fades now lift for focus on any control inside a Leaf widget's shadow tree too, such as a diff's rows or file headers, as the rule's wording intends. On main a bounded block kept fading while a diff's file row held focus, in both engines; it now lifts, a visible change on those pages.
Neither adds a mechanism or a case. The note's second candidate also changed
ringBoxand hadwa-inputandwa-selectdeclare--lf-wears-ring. Measured here, those add room only to the select (under a pixel without, 6.8px with), whose ring is already whole without them, and the declaration onwa-inputwould also claim the floating panel's search field, whose wrapper wears its ring. So they stay out.Evidence
The note's six cases from 2026-10-25, rebuilt on this branch's base (1b3e077) in headless Chromium 156 and Firefox 157. "Room" is the space between the ring's outer edge and the clipping edge; negative is cut.
live-progress, the "Release notes" summary in the stuck trackaside.sidebarnow; alayout-trackbeside a column keeps whole rings (3px)wa-select, 3px past the footwa-sliderA sweep that brought each control in by Tab from 4px inside to 24px past each edge found no faded arrival, and no cut one at the top or foot beyond one Chromium reading of the slider at −0.02px, flush with the edge. The select and the slider keep under a pixel there, since their ring stands on a box beyond the focused node (the combobox, and the thumb 7px below the rail); the filter and Copy keep 6 to 8px. No bundled widget uses a
wa-selectorwa-slider.The filter's and the select's rings are still cut 3px at each side, since they fill the block's width and the block has no inline room. A link that starts a line loses 5px at its start, and a summary 5px at each side. That is the case that remains, and the note holds its measurements, candidates and reproduction.
Tests
test_a_key_onto_a_control_at_a_scrollers_edge_shows_its_ringgains the diff's file filter in Chromium and Firefox, and now also asserts that the bounded block doesn't fade the arriving ring. Flipped back to main's sheets, it fails in both engines (room −0.6 and −1.0, faded). With main's landing rule alone it fails on the room, and with main's fade rule alone on the fade.test_a_scrolling_table_keeps_its_row_names_in_viewnow focuses a control in a shadow tree in the scrolled table and asserts that the table's mask and the row-name fade both go, in both directions. It fails with the old check on the row-name fade.wa-selectin a scrolled row-named table, a diff's file row in a bounded block, and a control in a shadow tree in a thread card's transcript. Each fade stays on the base and lifts here. On main the card's top fade stayed for every focused control in the transcript, an ordinary button included, not only one in a shadow tree (the cause, inferred from the selector and not traced, is a:has()nested in a:has()that never matched), and it now lifts for all of them with no scroll moved. No test holds the thread card's case.test_focus.py; the fade tests intest_render_pages.py; Copy's tests intest_render_code_reading.pyandtest_render_anchors.py; the diff filter tests; the ring tests intest_rings.py;test_workspaces_and_bounds.py -k "bound or more"but one;tests/model/test_interact_layer.py;test_the_thread_card_opens_on_its_latest_message_under_its_own_name;pnpm run test:runtime.test_lifecycle_and_controls.py(aquerySelectoron null, then the.library-selectcombobox never appears),test_workspace_end_room_stays_inside_the_last_reading_region[pane](a key badge intercepts the click), andtest_the_menu_s_search_finds_rows_threads_and_commands(an unchangedhiddenwrite on.lf-fp-quick). I didn't look for their cause.Not run: the corpus ring sweep (
test_each_sampled_focus_ring_is_shown_whole_in_its_surface, journeys tier),leaf-dev stillsacross the catalogue, and WebKit.Part of #4125