Repository navigation
fix: let a focused box's own focus treatment outrank Leaf's focus mark - #5524
Merged
Merged
Conversation
Since #5306 a focused page control wears data-lf-mark="focus", and the mark rule drew it as the box's own outline at !important. That took the outline from whatever the box said about its focus: an author's `#candidate-input:focus {outline: 4px ...}` read 2px, and the trace canvas, a ring overlay that turns its outline off and rings itself with an inset ::after because its viewport clips it flush, drew a second ring 3px outside that the viewport cut. Focus alone is the box's focus ring, not a comment's mark, so it now stands at no weight, as the focus floor does, and the box's own focus treatment wins. Every other mark keeps its important outline, so a page rule turning outlines off still leaves an aim, trace, comment mark, proxy or location ring standing. Behavior changed: a page control's authored focus outline shows again in place of Leaf's, and a ring overlay's focus draws only its inset ring. Closes #5478
This was referenced Nov 5, 2026
This was referenced Nov 7, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 7, 2026
…ary test (#5668) #5524 made focus alone (`data-lf-mark="focus"`) draw Leaf's ring at no weight, so the box's own outline wins. Its comment in `surfaces.css` says so: "the box's own focus treatment wins, an author's outline or a carrier's". The `rounded` target in `test_target_brackets_and_focus_share_the_visible_boundary` has an authored `outline: 1px dashed`. After Escape it now shows that outline, but the test still expected Leaf's solid 2px ring. That expectation came from before #5524, so this updates it instead of rolling #5524 back. **Behavior the test now protects:** focus alone on a box with an authored outline shows the page's outline. The `square` target has no outline of its own, and it still checks Leaf's focus ring, whole, on the region's perimeter. The aim and a draft's mark still stand over the page's outline on both targets, and the page's outline comes back once no mark stands there. **What stays open:** the fixture's dashed outline is decorative, not a focus style. So on a box like this, keyboard focus no longer gets a ring of its own. That follows from #5524's rule, which treats this the same way the focus floor treats every other control. #5525 already asks `max-sixty` whether focus should keep a ring the page can't remove. This PR doesn't decide that, and if the answer is yes, this subtest's focus step goes back to expecting the ring. **Verification:** the test fails on main at `a54c1bcea` in its `rounded` subtest (`'dashed' == 'solid'` at `test_render_aim.py:3658`) and passes with this change. `ruff check` and `ruff format --check` are clean. Closes #5647 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
pushed a commit
that referenced
this pull request
Nov 18, 2026
…ing on a commentable box (#6397) Records #5525's decision in the header of `browser/styles/components/surfaces.css`: on a commentable control, focus alone stands at no weight, so a page's `:focus { outline: none }` or decorative outline replaces Leaf's ring, as an author's outline replaces the browser's own focus ring. The header now says the user chose this and why the `!important` alternative fails (it overrides the author's focus outline and a ring overlay's `outline: none`, drawing a second ring outside the overlay's clipping box). This is a comment-only change. The tests from #5524 and #5668 already expect this behavior. Refs #5525 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.
Since #5306, a focused page control wears
data-lf-mark="focus", and the mark rule insurfaces.cssdrew that as the box's own outline at!important. That overrode whatever the box said about its own focus, and broke two tests on main:#candidate-input:focus {outline: 4px solid violet}on a playground candidate read2px(test_playground_controls_take_focus_from_editors_and_keep_candidate_focus).::after, because its viewport clips it flush. Under the mark it also drew an outline 3px outside, which the viewport cut (test_trace_pointer_annotation_stays_inside_the_panned_image_viewport).Focus alone is the box's focus ring, not a comment's mark. It now draws at no weight, as the focus floor does, so the box's own focus treatment wins. Every other mark (aim, trace, a comment's mark, proxy and location rings, and focus combined with any of them) keeps its
!importantoutline.What changes on screen: a page control with an authored focus outline shows that outline again instead of Leaf's 2px ring, and a ring overlay's focus draws only its inset ring.
leaf-dev stillsfortrace-image-keyboard,playground-text,playground-choice,gallery-tab-focusandproxy-drawingcame out pixel-identical between base and head; the trace canvas's extra outline fell wholly outside its clipping viewport, so it was never visible.What this gives up from #5306: #5306 made marks
!importantso that a page rule turning outlines off leaves the mark standing. For focus alone, a page's:focus {outline: none}on a commentable control now removes Leaf's focus cue there. That is how the focus floor already treats every other control. #5525 asks@max-sixtywhether focus should keep that guarantee.Verification: both tests fail on
a6fefaa77and pass with this change. These neighbouring ring and focus tests also pass:test_a_marked_scrolling_visual_keeps_its_keyboard_focus_ring, the ring-reading tests incontrols/test_rings.py, twocontrols/test_focus.pytests, the mark-contour tests intest_render_anchors.py, and all oftest_render_playwright_trace.py.Closes #5478 — automated triage