Skip to content

Stand every focus mark on a region on one perimeter, 6px out - #4732

Merged
max-sixty merged 6 commits into
mainfrom
focus-kinds-spacing
Oct 30, 2026
Merged

max-sixty merged 6 commits into
mainfrom
focus-kinds-spacing

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Leaf's focus marks stood at different distances from the same block. Since #4294 the Alt aim, a comment's brackets, the margin trace and projected keyboard focus stood flush on a region's edge, while the location ring that arriving with m draws stood 3px out. Prose has no padding, so the flush line ran along the first letter of every line, going from aim to comment to arrival moved the frame 3px each time, and two marks on one question drew two lines.

browser/base.css now states the rule beside the ring tokens. What a mark says sets its stroke: the focus ring and the location ring draw the whole band, brackets draw its two ends, an SVG target takes its own contour, and a large composite takes a quiet ground. The box a mark stands round sets where the band stands:

  • a region (a section, question, figure or paragraph) at --focus-region-gap, 6px out, which every mark on it shares;
  • a control at its ring's 3px gap, or closer where its neighbours stand closer;
  • a field on its border;
  • a box packed into a list, padded inside a frame it fills, or clipped with no room outside, one band inside its edge.

The user chose 6px for regions from captures at 3px and 6px: at 3px the band still stood close to the first letter, and past 6px a bracket meets a heading's link icon.

How the marks follow it

  • standOver (browser/runtime/target-paint-geometry.js) decides, for the aim, the trace and every comment mark alike, whether the mark stands on a control, on a region, or inside a target its clip leaves no room around, and how far it may reach past each side a scroller cuts. css-anchors.js reads that room per side, and visual-mark-paint.js no longer checks for cramped targets on its own.
  • The bracket overlays draw with the outline's own offset, so their corners round as the location ring's do, and the aim's tint fills out to its brackets.
  • The location ring on a question and on an lf-ask stands at the region gap. A landing keeps the widest ring's room at a scroller's edge (--focus-ring-landing), and the sidebar's track body and full-height tab sets pad by the region's room so the ring isn't cut there.
  • A choosing lf-options that is itself the decision hands its location ring to the row the user tabs to, as one inside an lf-ask already did. It used to keep both, two accent lines a few pixels apart.
  • A page's own tabs hang their panel's ring from the strip's rule and stand it 6px clear of the text on the other three sides. Inside the panel's edge, the band had run down the first letter of every line, and out on the top too, the strip covered it. A boxed set, a side list and a page's parts pad their panel inside a frame, so their ring stays inside.

Tests

Changed behavior: brackets, the trace, projected focus and the location ring on a region stand 6px out; a page tab's panel ring stands outside the panel on three sides. Tests that read the old distances now read the region gap from the theme. New tests cover a bare choice handing its ring to the row, the aim and a comment standing inside a table cell its frame leaves no room around, and the page tab's ring standing 8px out (the gap plus the band) on three sides. The bare-choice and page-tab tests fail with their CSS rule disabled. mark_edges takes an outset for a mark standing outside the element's edge.

Left for follow-ups

  • An SVG part still changes shape between aim and comment: Alt brackets the part's box, while a comment draws the part's own contour at 1.5px.
  • Where a box stands its mark is decided twice. standOver decides it for the overlays, and each control's CSS ring rule decides it for that control. The overlays don't know which boxes draw their own ring inside: Alt over a label.choice stands 3px out, while its keyboard ring stands 2px inside. The CSS rings don't get the overlays' clip check either: a question's location ring or a page tab's panel ring inside an unpadded overflow: clip box loses its sides. One per-box property, read by both the CSS rules and standOver, would settle both.

This was written by Claude Code on behalf of max-sixty

…which

A page region wore its marks at two distances: the Alt aim, a comment's
brackets, the margin trace and projected keyboard focus stood flush on
its edge (#4294), while the location ring an arrival draws stood at the
ring's 3px gap. Prose has no padding, so the flush line ran along the
first letter of every line; going from aim to comment to arrival moved
the frame 3px, and commenting on the question the user stood in drew two
accent lines 3px apart.

theme.css now states the rule for every mark: what it says sets its
stroke (whole ring, location ring, brackets, a shape's contour, a quiet
ground), and the box it stands round sets where the band stands (a
region at --focus-region-gap, a control at its ring's gap, a field on
its border, a packed or cramped box one band inside). The bracket
overlays draw at the region's gap with the outline's own offset, so
their corners round as the location ring's do, and the aim's veil fills
to the brackets. A mark on a control (standOver marks it
data-lf-mark-on="control") keeps the control's gap. --focus-region-gap
is the ring's gap for now; the proposal page asks whether regions should
stand further out.

A choosing lf-options that is itself the decision now gives its
location ring up to the row the user tabs to, as one inside an lf-ask
already did; it kept both, two accent lines a few pixels apart.

Changed behavior: brackets, the margin trace and projected focus on a
region stand 3px further out, on the location ring's perimeter. Tests:
the shared-boundary test reads the region's gap instead of 0; the trace
screenshot clips wide enough for the trace's new place; a new test
covers the bare choice handing its ring to the row (fails without the
options.css rule).

> _This was written by Claude Code on behalf of Maximilian Roos_
Review of the perimeter change found three gaps. The Alt aim and the
margin trace never asked whether a clip left their target room, so an
aimed cell of a joined choice stood its brackets across the frame and
the next cell while the comment's mark on the same cell stood inside:
aim to comment moved the frame 7px. Every boxed stand also let its band
run 5px past every frame edge, including an edge the frame already cut
the target at, so a paragraph scrolled half out of a pane drew bracket
stubs over what lay above the pane. And two places asked whether a
target is a control.

`standOver`, which every painter calls, now decides once: a control or
a region (`data-lf-mark-on`), inset where a clip leaves no room
(`cramped`, moved here from visual-mark-paint.js), and per side how far
the frames let the band run past their edge: the mark's room, or none on
an edge they cut the target at (`--lf-paint-outset-<side>`, read by
`cutPath`). The design label stands above the brackets rather than over
their top run.

Changed behavior: a mark on an edge its scroller cuts stops at the cut
(it ran 2px past before the perimeter change, 5px after); an aim or
trace on a cramped target stands inside it as a comment's mark does; an
inset bracket's arms are 8px, as an outward bracket's are, rather than
6px. Tests: the shadow-surface clip and the shared-boundary test expect
no band past a cut edge; the trace, the projected contour and the
margin status read the region's gap instead of 0.

> _This was written by Claude Code on behalf of Maximilian Roos_
At the control ring's 3px, the band round a region stood 3px from the
first letter of every line, since prose has no padding inside it as a
control's label has. The user chose 6px for regions, controls staying at
3px (29 October 2026). Past 6px a bracket meets a heading's link.

A landing reads `--focus-ring-landing` as focus arrives, before the
runtime marks the box an obligation, so it now clears the widest ring, a
region's: an obligation landed at a pane's top stood with its ring cut
under the pane's edge. The scrollers that hold page content full-width
and keep the ring's room as padding (a sidebar's track body, a
full-height tab set) now keep a region's room. A picture's frame rings
at the region's gap.

Changed behavior: region marks and the location ring stand 6px out; a
landing keeps 10px rather than 7px; a sidebar track body and a
full-height tab set pad 3px more. Tests: a new one checks that the aim
and a comment's mark both stand inside a cell a joined choice clips;
the shared-boundary test's scroller is taller, so its card keeps room
outside at the new gap.

> _This was written by Claude Code on behalf of Maximilian Roos_
# Conflicts:
#	browser/base.css
#	browser/runtime/annotation-overlay/visual-mark-paint.js
#	browser/runtime/chrome.css
#	dist/kernel/kernel.json
A page's own tabs draw no frame and pad no side of their panel, so the
panel's ring, standing one band inside the panel's edge, ran down the
first letter of every line when the user tabbed into the panel. It now
stands a region's gap out on the panel's left, right and bottom, and
keeps its top on the strip's rule. Standing out on the top too put the
band behind the strip, leaving three sides of a box; the user picked the
hanging ring from the three side by side.

A boxed set, a side list and a page's parts pad their panel inside a
frame, so their ring stays inside; base.css now names that case among
the boxes whose band stands one width inside.

test_a_scrolled_tab_keeps_its_focus_ring_at_the_viewport's page-tab
case reads the ring where it now stands, through a new `outset` on
mark_edges; its boxed and markdown cases still read it at the edge.
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit 88d5378 into main Oct 30, 2026
4 checks passed
@max-sixty
max-sixty deleted the focus-kinds-spacing branch October 30, 2026 06:33
max-sixty added a commit that referenced this pull request Oct 30, 2026
…ry mark (#4773)

Where a focus ring, a location ring or an overlay mark stood round a box
was decided in two places. Each control's focus rule set a distance of
its own, eight of them from 5px inside to 6px outside, 17 written as
lengths, and `standOver` sorted targets into controls and regions
separately. They disagreed wherever a control's rule chose otherwise:
Alt over a choice's label stood 3px out while its keyboard ring stood
one band inside.

A box now states it once, as its own `outline-offset` in its face's
rule, from four kinds base.css names ("Where it stands"): a region's
gap, a control's, its edge (0), or one band inside
(`--focus-ring-inset`, new). The layer's focus floor draws every
keyboard ring, so a control's rule no longer restates the ring to set
its distance; a box that wears the ring for a control inside it draws
one and states its kind on itself. `standOver` reads the target's stated
offset and keeps its own guess, a control's gap or a region's, for a box
that states none. A stated 0 reads as none there, since 0 is the
property's initial value, so a mark round a field stands at a control's
gap; the spec says so. `test_every_ring_stands_at_a_kind_of_box` refuses
an `outline-offset` written as a length. Rules that set a ring's
distance only while the box holds focus go from 60 to 17, the floor and
the boxes and pseudo-elements that wear a control's ring.

Behavior changes, which tests and stills read:
- Buttons, inline presses, a quote, the composer's Send and Dictate, an
attachment, a trace's timeline, a live sample's frame, a tab's name and
a thread card's buttons stood 1-2px out and stand at a control's 3px.
- Margin entries and reactions, 4px apart, and a diff line's comment
press stood 1px out and stand on their edge.
- The rows of every list (`.lf-row`), a table's cells, a choosing
group's rows and its add row, a gloss and a draft stand their ring, and
every mark over them, one band inside; a draft's ring stood 5px inside.
A timeline's steps and a review's cases stood 3px out.
- A side list's tab rings its whole row, inside its edge, where the ring
round its name ran over the summary under it, and its open panel fills
its cell, so the panel's ring meets the frame when the list is taller
than the panel. Only the open panel stretches: a closed one keeps its
box in the cell.
- The Alt aim over an SVG element traces its contour, as a comment on it
does; it bracketed the element's box. A whole inline `<svg>` is a box
for both, bracketed rather than traced shape by shape.
- An action's target no longer draws a 1px accent outline inside its
edge under the overlay's brackets.
- The floating panel's faces and its view chooser read the runtime's
focus-visible rather than the browser's, at the inset token, and the
floor leaves a box whose focus the overlay projects to the overlay.

Tests: `test_a_side_lists_open_panel_rings_its_whole_cell` covers the
side list (both halves fail with the fix reverted); the aim test on a
cramped cell reads the mark's offset rather than the removed
`data-lf-mark-on`; the ring cases expect the floor where it now draws.

Follows #4732.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 1, 2026
The cross-tab obligation walk fixture now declares its outer tabs as
`layout-flow`, restoring the page-tab boundary it is meant to exercise.
#4724 replaced automatic promotion of the first tab set with explicit
authored layout; the unchanged fixture became a boxed set, whose local
sticky strip was absent from its root-scroll-padding expectation. Both
variants reproduce the reported 68.953125px assertion failure on main.

The expected landing now includes the question's computed scroll margin
instead of a hard-coded 5px. #4732 deliberately increased region focus
clearance; declaring the page flow alone still fails both variants
against the old expectation. The existing 3px rounding tolerance stays
unchanged, as do the frame-by-frame instant arrival, disclosure glide,
tab cue and Back-history assertions. This changes only the test setup
and expectation, preserving both changes' product behavior.

Validation: both reported cases fail before the repair and pass after
it, including both at 6× CPU throttling. Ruff lint, formatting and diff
checks pass. The test-only diff received a structured correctness and
cleanup review with no remaining findings.

Closes #4908 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 1, 2026
The Design label test still measured attachment to the target's box
after #4732 deliberately moved the label outside the region's painted
ring. It therefore failed on the intended 8px clearance rather than a
detached label.

Measure against the bracket outline's visible top edge, using its
computed width and offset. The existing scroll and panel checks remain.
No page appearance changes.

The original assertion fails on main with an 8.33px gap. The corrected
browser test passes, and restoring the pre-#4732 label offset makes it
fail with a 5.67px overlap. Ruff check and format check pass.

Closes #4909 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 11, 2026
Next On Me (`m`) focusing an ask's options in a margin card drew its
location ring with the whole right side missing and the foot of its
corners cut, in Firefox and Chromium. The ring stands a region's gap
outside the block (6px) and is 2px wide, so it reaches 8px; the card's
transcript kept 6px past its edges (`max(--focus-ring-room,
--lf-group-ring-end)`), so the whole band fell past the transcript's
padding edge on the right. The room fit when it was set, at a control's
3px gap; #4732 moved every mark on a region to 6px and left the
transcript's room where it was.

The transcript now keeps `--focus-region-room` (8px). It takes the extra
2px from the card's inset as before, so the words keep their place:
`leaf-dev stills` of every margin card state at rest shows 0 changed
pixels in Chromium and Firefox, and only the new
`ship-card-ask-keyboard` state (ship-review's first `m` arrival, an ask
in a card) changes, where the ring becomes whole. The
`browser/runtime/chrome.css` header, which said every scroll region
keeps a control's room, now says a scroll region pads its edges by the
room of the widest ring it holds.

Tests: a margin card test lands `m` on a reply's options and reads their
ring whole; it fails without the fix (right and bottom edges 2px outside
the transcript).
`test_the_thread_card_opens_on_its_latest_message_under_its_own_name`
scrolled the transcript's box edge to the middle of the gap between two
messages, where it meant the line heads stick on; that line stands one
room below the edge, so the wider room put it on the next head. The test
now aims at the line and passes with either room.

Bounded blocks, the case #4125 holds open, still keep no room at their
sides; this change doesn't touch them.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 12, 2026
A thread card, and the comment box before it, stood 8px (`COMMENT_GAP`)
from the box of the element it is about. Since #4732 moved region marks
6px out, the bracket round that element is drawn 8px outside the same
box (a 6px gap and a 2px stroke), so the card's border sat exactly on
the bracket's line: its left edge beside the element, its foot over it.
The placement now keeps `subjectGap`, the mark's room plus
`COMMENT_GAP`, from its subject on every side, so the bracket and the
card's edge have the same 8px between them that the card keeps from the
window's edge. tokens.css registers `--focus-region-room` as a length so
the placement reads the token rather than repeating its formula.

Measured in Firefox and Chromium on a `layout-column` page with a
comment on an `lf-shot`: beside it at 1440px, the card's left edge moves
from the bracket's outer edge (gap 0) to 8px clear, and the card narrows
from 344px to 336px with its right edge still 8px from the window; above
it at 1280px, the card's foot moves from the bracket's top line to 8px
clear.

To weigh: the gap holds whether or not a mark shows, so a card on a
passage of words, which draws no bracket, also stands 16px from its
paragraph, and a card needs 8px more room before it gives up standing
beside and goes under or over. Keeping one gap stops the card moving as
the margin trace and Alt aim come and go.

Max asked for this on 4 November; that session committed it on a branch
it never pushed, and this PR carries it onto current main. Runtime
suite, browser type check, the focused margin and send-placement tests,
and the nightly placement sweep pass. CI's `test` job reports one
teardown error, a "ResizeObserver loop" window error in
`test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[combined-selection]`.
It comes from the browser tests' swap watch (#5754), not the page: under
`taskpolicy -b` it fires 3 of 3 times on main and on this branch alike,
and 0 of 3 times with `swap_watch.js` left out.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants