Skip to content

Stand Leaf's boxes on their frame's edge or clear of it - #6812

Merged
max-sixty merged 14 commits into
mainfrom
thread-reply-box-padding
Nov 23, 2026
Merged

max-sixty merged 14 commits into
mainfrom
thread-reply-box-padding

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

#6773 stated a rule in browser/AGENTS.md: a box inside a frame either meets its edge, taking the frame's rounding at the corners they share, or stands clear of it. A survey of every box Leaf draws inside a frame found 57 that meet or nearly meet an edge with the wrong corners. This fixes 49 of them, and the defects of the same kind two fresh reviews found; #6803 fixed two more.

  • Leaf's word and symbol presses and its reactions draw their focus ring inside their edge, set once per role, so a frame's edge no longer cuts it; the panel's leaf keeps its ring on its edge, where its badges would otherwise cover it. A code block's lone Copy, which takes the focus on its own toolbar, rings inside that toolbar's edge rather than 3px outside it, where the ring ran onto the block's edge.
  • A holder whose presses join into one control declares data-lf-joined, as a block's toolbar and a question's Done cell do: each press is square at the seams and takes the holder's rounding at its corners. The press-face guard allows only a declared variant, and a clip would cut a finger's reach past the toolbar, so the corners are per-corner radii from a holder token.
  • In a question's joined options, every cell standing in one of the group's corners takes its rounding there, in a stack and laid across, so a pick's ring and the keyboard's stay whole round the corner instead of thinning where the group's clip cut their square corners. Done joins as a cell: no edge of its own, where it drew a second one inside the group's, and its cell wears its ring, as a row wears its mark's. Done's digit and Add's stand in the column every card's digit shares.
  • --lf-clear (4px at every density) is the least room that reads as standing clear, and the toolbars, a board card's grip, Add, a suggestion's contents and a diff filter's fold-all stand that far from their frame. --lf-r-in, a frame's rounding inside its hairline, replaces five copies of that length. A pane clips to its rounding, and a comment box's key badge stands centred on its line, clear of the box's foot.
  • In the panel, the search's scope chip and its steps stand --lf-clear inside the field, the steps' faces a line tall less that room above and below, and the match count --lf-clear before the first step. On Me's Reply no longer hangs its word into the card's margin, where its face crossed the ring a walked card wears; controls.css now says a seat hangs a press only into a margin that leaves --lf-clear at the frame's edge.

Worth a look in use: a bordered button's focus ring now lies over its border (Max may revise this; the square-corner rule itself is on trial). On Me's Reply now lines up its face with the card's text edge, where its word used to stand, so the word sits 13px further in. A lone titled option laid across now counts as stacked, since it shares its row with no sibling; its chips no longer float beside its state mark. The other six findings are measurement artifacts, an example page's own button, and the diff gutter's +, left 2px inside its line. Max asked for the survey and the fixes; the before/after pairs are on the decision page.

Part of #4125: rings on Leaf's presses keep inside a scroller's clip; rings on other boxes, and scrollers that keep no room, remain.

Model tests for faces, rings and tokens pass, apart from the skill-file size check, which main fails too (module-input.md, from #6816), as do focused browser tests for Done, drafts, code Copy, boards, Add, diff controls, panes, the file tree, rings, workspaces and reactions.

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

A survey of every box Leaf draws inside a frame found 57 that break the
rule #6773 stated in browser/AGENTS.md, "A box inside a frame either meets
its edge or stands clear of it". This change fixes 43 of them; the rest wait
on two sessions editing the panel's and the card's stylesheets, or are
measurement artifacts and a page's own button.

- Leaf's word and symbol presses and its reactions stand their focus ring
  one band inside their edge, set once on each role (controls.css), so a
  ring no longer runs into the panel's or a card's edge. Five per-seat
  copies of that declaration go.
- A holder whose presses join into one control declares `data-lf-joined`,
  as a block's toolbar of marks and a question's Done cell do. Each press is
  square at the seams and takes the holder's rounding (`--lf-joined-r`) where
  it meets the holder's corners. The press-face guard allows only a declared
  variant, so the holder declares it rather than a seat restyling the press.
  Per-corner radii, not a clip, since a clip would cut a finger's reach past
  a 24px toolbar.
- Block toolbars, a board card's grip, Add in an options row, the file
  tree's search field, a diff filter's fold-all and a block suggestion's
  contents stand 4px clear of their frame.
- A pane clips to its rounding, so a file tree or editor that paints to its
  edges takes its corners; the worktree summary takes the worktree's.
- Marks no longer take the generic hover wash, matching the ink-only face
  the user chose for them.

Model tier (test_interact_layer, test_interface_fonts,
test_chrome_contracts) and focused browser tests for Done, drafts, code
Copy, boards, Add, diff controls, panes, file tree, rings, workspaces and
reactions pass.
…ined group, and name the clearance

A fresh review of the previous commit found a mark's focus ring standing 1px
inside its toolbar's hairline, the near-miss the rule forbids, because the
toolbar kept a 1px padding its marks' outside rings once needed. The toolbar
now pads its joined marks by nothing, so they meet its hairline and take its
rounding less the hairline; a lone Copy keeps its padding, since its ring
still stands outside the mark.

Done in a joined options group drew its own border inside the group's frame,
two edges where every other cell shares one, against the group's own rule
that its cells draw no edge. A holder that clips its presses to its corners
(`--lf-joined-r: 0px`) now draws the run's edge, and a word in it draws none.
Standing apart, Done keeps its border.

`--lf-clear` (tokens.css) names the least room that reads as standing clear
of an edge, 4px at every density, and the seats the previous commit stood
clear read it: block toolbars, a card's grip, Add, a block suggestion's
contents and a diff filter's fold-all, whose face is now worked out from the
field's line.
… cover it

Drawn inside the leaf's edge, as every symbol press's ring now is, the ring
ran under the unread dot and the On Me count. On the leaf's edge it reads as
one ring with the badges on its corners, and stands 4px clear of the panel's
edge, where at a control's gap it stood 1px off it.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moves the focus ring of every Leaf word and symbol press, Copy included, one band inside its edge, so a scroller's clip no longer cuts those rings. That covers part of backlog #4125 ("Settle how focus rings keep their room at a scroller's edge"), which names Copy's cut ring as one of its cases. If you agree, consider adding Part of #4125 to the description. What would remain is rings drawn outside boxes that aren't Leaf presses, such as Web Awesome controls whose ring sits on a different box from the focused node, and scrollers that reserve no room.

max-sixty and others added 2 commits November 22, 2026 19:14
…ng a lone Copy inside its toolbar

A fresh review of the box-edge fixes found two rings that broke the rule they serve.

A question's joined options clip their cells to the group's rounding, but every cell drew a
square ring inside its edge, so at the group's corners the clip thinned a pick's ring and the
keyboard's to a pixel. Done, now square in the group, showed the same at the foot. Each cell
standing in one of the group's corners now takes the group's rounding there, in a stack and
laid across, and Done's cell wears Done's ring, as a row wears its mark's. A lone titled option
laid across no longer counts as sharing a row, since it has no sibling to share it with.

A code block's lone Copy takes the focus on its own toolbar, which stated no ring placement, so
its ring stood 3px outside the toolbar and ran onto the block's edge. It now rings inside the
toolbar's edge, as a press seated in a corner does.

--lf-r-in names a frame's rounding inside its hairline, which five rules spelled out.

Co-Authored-By: Claude <[email protected]>
…lumn, Done's with no edge to push it

Since Add's face grew to its row's line, Add's digit, centred on Add's seat, stood 1.1px
off the column the other cards' digits share, which test_a_questions_options_own_their_digit_bindings
caught. It now stands in that column, inside the seat it still takes while Add is hidden.
Done's digit stood 1px off the column too, pushed in by the transparent edge Done kept in a
joined group; that edge now takes no room.

Co-Authored-By: Claude <[email protected]>
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
A key badge in a comment box's hint stood on the words' baseline, so its box, as tall as
the line, hung 1.5px below it: in the diff's floating comment box it stood 2.7px from the
box's foot and 6.3px from its head, nearly meeting the foot. Centred on its line it stands
4.5px from each, and concentric with the words beside it, which stay where they were.

Co-Authored-By: Claude <[email protected]>
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
…ed first option's corner

The rules that round a joined group's corner cells named no element after the
group's `:has()` (`& > :first-child`, `& > :last-child`), which
test_a_has_leads_only_to_a_subject_naming_an_element refuses: in Chromium such a
subject lets a hover restyle the whole page. Each selector now names its cell, an
option, Add or Done, one key per selector.

The first cell is now the first option (`lf-option:first-of-type`) rather than the
first child. A word Leaf writes for a screen reader, such as "my change" once the
user picks, stands before the first option, so the old rule rounded that hidden word
and left the picked option's ring square at the group's head corner, where the
group's clip thinned it. Stills against the last commit change only that corner
(plan-option-picked, ship-option-answered).
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
…e's Reply inside its card

The search's scope chip stood 2px from the field's end, and its steps' faces met
the field's top, bottom and end with rounded corners. Both now stand `--lf-clear`
(4px) inside the field: the chip by its margin, with a chip's corners
(`--lf-chip-r`), and the steps by a face a line tall less that room above and
below, with the actions keeping that room at the field's end.

On Me's Reply hung its word into the card's margin by its whole inset, so its face
stood 1.5px from the panel's edge and 5px past the card's own edge, across the ring
a walked card wears. It no longer hangs: its face starts on the card's text edge,
6px clear of the ring, so its word stands 13px further in than the card's text.

The merge of main brings #6803, after which the comment box's Dictate stands 5px
and 8px clear of a card's edges, so it needs no change here.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
… a seat may hang a press

The previous commit shrank the search's steps to 24px faces, so "3 of 3" ended where
the Previous face began: 7px from its glyph, where main had 11, and a hovered face's
fill touched the last digit. The count now keeps `--lf-clear` before the first step,
which puts it 11px from the glyph again and costs the field 4px.

controls.css now says when a seat may hang a press into a line's margin by its
inset: only where the margin leaves `--lf-clear` between the face and the frame's
edge, and otherwise the face starts at the text edge, as On Me's Reply does since the
previous commit. Reply was the last press hung by `--lf-word-inset`, and nothing
checks the room, so the next seat to hang one reads the condition where the insets
are defined.

Both come from the independent review of 8892c56.
The previous commit stated, in the comment on the ring rule, that a seat hangs a press only into a margin that leaves --lf-clear at the frame's edge. An author writing a hang reads the definitions of --lf-word-inset and --lf-symbol-inset, which still told them to hang with no condition. The condition now sits in --lf-word-inset's comment, and --lf-symbol-inset's points to it. Raised by the independent review of 191b534.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
…ymbols alike

a45f64e had --lf-symbol-inset hang where the margin 'has the room --lf-word-inset asks for', which reads as a margin as wide as the word inset (18px on a page-font press) rather than the symbol inset plus --lf-clear (13px). Its fallback also said the face 'starts at' the text edge, which fits a word leading a line but not a symbol ending one. Both comments now state the margin as the inset plus --lf-clear, and the fallback as the face standing on the text edge. Raised by the independent review of a45f64e.
@max-sixty
max-sixty merged commit c51ae9b into main Nov 23, 2026
5 of 6 checks passed
@max-sixty
max-sixty deleted the thread-reply-box-padding branch November 23, 2026 15:43
max-sixty added a commit that referenced this pull request Nov 23, 2026
)

Narrows the last sentence of `browser/AGENTS.md`'s rule "A box inside a
frame either meets its edge or stands clear of it". It said a box
standing clear of every edge "is rounded all round", which, read
literally, flagged 68 boxes Leaf draws square or round on purpose (list
rows and their rings, region rings and fills, dots and count pills,
sliding thumbs, runs of joined diff files) and contradicted "a box edged
on one side is never rounded" beside it. Now a box that stands clear, by
`--lf-clear` or more, keeps the corners its kind takes under
`tokens.css`'s corner scale; so does a sliding thumb or a mark round by
meaning, wherever it stands; and boxes joined at seams count as one box.
The half for a box that meets its frame's edge is unchanged, and the
heading keeps its words, so the comments citing it still match.

The survey behind #6812 found the 68; Max picked this wording on the
page that reported it, and the wording's one change since is a split
sentence (below).

In a scratch A/B, Sonnet answered five cases from each version of the
passage, twice each. Both versions got the box that meets an edge right.
The new one handled the run of joined files as one box in 2 of 2 (old: 2
of 2 by way of the segmented-group rule), a 2px near-miss in 2 of 2
(old: 1 of 2), and a thumb 2px inside its track in 1 of 2 (old: 0 of 2).
The thumb miss read "as does a thumb" as applying only to a thumb
standing clear, so the thumb now takes a sentence of its own ending
"wherever it stands". With that sentence, three more runs each kept the
thumb's shape (3 of 3), fixed the near-miss (3 of 3) and gave list rows
their kind's corners, squaring a striped row by the rule beside it (3 of
3, as the old version did).

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 23, 2026
…expect Add's empty badge in the cards' digit column (#6882)

`ci` on main has been red since #6812 (`c51ae9bb1`), with two main-tier
browser tests failing. Neither runs on a pull request, so #6812's own CI
never ran them. Both reproduce locally on every run with CI's exact
numbers. Each fails from `c51ae9bb1` on and passes at its parent
`0fe58f004`. Reverting one file of #6812 at a time narrowed each failure
to a single file.

**`test_code_copy_reads_sources_before_positioning_many_controls`**
(`controls.css`). The new joined-run corner rules include
`[data-lf-joined] > .lf-mark-action.lf-ui:nth-child(1 of
:not([hidden]))::part(button)` and its `:nth-last-child` twin. A
positional pseudo on the host compound before `::part()` makes Chromium
restyle every child of the host's parent on each insertion there. Adding
a class nobody carries to that compound, or changing the `of` list,
didn't help; deleting just those two selectors did. So with 60 lone code
Copies in `.lf-chrome`, one append to the chrome restyled 231 elements,
against 41 with one Copy. The fix sets `--lf-joined-start` /
`--lf-joined-end` on the press itself from the same positional rules,
and has every radius read them, the `::part(button)` face's included. A
probe of a notes-bearing code toolbar and a draft toolbar, with its
hidden presses, read the same four radii on every child before and
after.


**`test_obligation_action_binding_badges_use_the_available_card_action_seats`**
(`options.css`). #6812 deliberately moved the empty draft's badge to
`--lf-sp-2`, "the digit column every card's badge shares". It also moved
Add's face to `--lf-clear` from the row's end, so the badge's centre now
sits 1.1px from Add's (791.5 vs 790.4). The test asserted the old seat,
over Add's centre. It now asserts the cards' shared column, with the
badge still standing within the hidden Add press. That keeps #6812's
intent and leaves the rest of the test, including the press keeping its
seat once Add appears, unchanged.

Both tests fail on current main without this change and pass with it.
Pre-commit is clean on the changed files. Focused checks pass: code
Copy, a draft's finger reach past Copy, option rings, Done and the
corner digit, and `tests/smoke/test_plain_page.py`. Nothing changes on
screen.

Closes #6881 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…7025)

`test_the_draft_binding_badge_and_send_press_share_the_row_end` asserted
two layout facts that #6812 changed on purpose. #6812 moved the empty
draft's binding badge into "the column every card's digit shares" and
sized Add's face from its row's line (`--lf-icon-action-face: line +
2px`), standing it `--lf-clear` from the row's end. As a result, Add's
centre now sits 1.09 px from the badge's centre in the card group. Add
is also wider there (29.19 px, on a 27.19 px line) than in the row group
(24 px, on a 21 px line). The test still assumed the badge was centred
on Add and that Add was the same width in both groups, so it failed at
line 39. Once that assertion was relaxed, it also failed at line 95 (end
room 32.19 vs 27 expected).

The test now asserts the intended layout:

- The empty draft's badge has the same left and right edges as the
cards' digit badges (932–951 px for all three in the probe). The
vertical check stays as it was.
- The card group's field end room exceeds the row group's by the badge,
its spacing and the difference in Add's width.

The checks that Add keeps its seat when words appear are unchanged. The
test fails on `main` and passes with this change, and the rest of
`test_render_options_addition.py` passes. No CSS changes, so nothing
drawn moves. The badge and Add are never on screen in the same seat at
once: Add shows only once the field has words, and by then the badge has
moved inward.

Closes #7021 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 27, 2026
…7366)

`leaf-dev stills` now reads two kinds of geometry fault on both versions
of each state it compares, and lists each fault the change adds. Faults
both versions share stay out of the report. Max asked for this after a
thread card's unread dot came back touching the card's edge:
`browser/AGENTS.md` already forbids that, but until now nothing checked
it, and each break was found by eye.

- **Edges** (`dev/leaf_dev/geometry.js`), in any engine: a box Leaf
draws that nearly touches its frame's edge, crosses it, or is cut by it,
and a round mark closer to the edge than `--lf-clear` (4px). The
floating panel and the margin card draw their outline and rounded
corners on a separate layer behind them (`.lf-box-ground`), so the
reading takes their edge from that layer. A box's corner is read against
every clip around it, the frame and any box between, so a rounded clip
nearer than the frame rounds it too. It reads three cases from what the
page itself declares, with no rule written for any one widget, and
leaves them out:
  - parts of a Web Awesome component, which keep the library's look;
- thumbs: anything inside a `slider` or `scrollbar` role, or moved by a
scroll timeline;
  - marks inside a drawing (`--lf-drawing`).
- **Rings** (`dev/leaf_dev/rings.py`), in Chromium only: a focus ring
that a clip cuts or another box covers. This is the reading the ring
tests already use. It moves out of `tests/render_cases_layout.py` and
`tests/page_scripts/` into `leaf_dev`, so the tests and stills call one
implementation. In Firefox, its pixel check reported 4 rings on main as
unpainted along one edge, and a Firefox screenshot of one of them shows
that edge painted. So stills reads rings in Chromium only.

**Caught at the commit before each fix, gone at the fix:**
- **#7138, the unread dot.** At the commit before #7138, the edge
reading flags the dot touching the card's border (`round left 0px`) and
cut 1px by the transcript (`cut left -1px`), in Chromium and Firefox.
Diffing the commits before and at #6773, which caused it, gives exactly
those two findings. Putting #6773's dot placement back on this branch
makes stills print exactly those two lines.
- **#7256, the deck card's ring.** The ring reading finds it cut 8px on
each side and covered at the top and bottom.
- **#6395, the file tree search field's ring.** With the field focused,
the ring's top edge is 4px outside the tree. No catalogue state focused
the field at the time. The edge reading also flags the field itself
standing 1px below the tree's top edge.

**Not caught:** #6672 (an alignment pass), and a reading of Leaf's boxes
overlapping each other, which I built, measured and left out:
- On main it found 11 overlaps in Chromium (11 in Firefox), all
deliberate and none a defect. Examples: a picture's remove button on its
corner, Copy over its code block, a timeline's marks over its gridlines,
a margin pin over a board card.
- At the commits before the fixes:
- #6336: it caught the count badge covering the folded leaf's error dot,
but only on a page built the way #6336's test builds it.
- #6830: in the catalogue's state, the fold mark crossed the picture by
1px, the same as a seam between two boxes, so it missed.
  - #6615: list markers have no box to measure, so it can't catch them.

**Findings on main, all 334 states:**
- **Edges:** 13 findings from 4 causes, the same in Chromium and
Firefox. Chromium adds 2 more from a 5th cause, in a state that holds
the runtime back, which Firefox can't open. All are real breaks of the
rule; there were no false alarms.
- **Rings:** 2 findings in Chromium, both false. In each, an overlay
scrollbar covers the ring's edge; the stills browser keeps scrollbars
visible on purpose.
- Since stills reports only faults a change adds, none of these show in
an ordinary run.
- **Cost:** the reading adds a median of 0.1 s per side of each state
(0.3 s at p90, 1.3 s at most), next to about 5 s to open that side.

**The live edge breaches, and whether Max chose them** (from `git log
-S`/`-L`; this PR fixes none of them):
- **The folded leaf's count badge and news dot**, 1px and 3px from its
edge: an accident. #3650 shrank the leaf and kept the badges' offsets.
- **The unread dot on the corner of a margin pin and a margin entry**,
touching the face's border: Max chose the top-left corner (#6627, and a
test pins it) and the dot's size (#6340). The touch came from #3796,
which listed the dot sitting on the corner as a point for reviewers to
look at; nothing records Max choosing it.
- **The 1px strip in the screenshot comparison**, between the frame's
border and the picture: an accident of #3704's transparent frame border.
- **The option list's rounded corners before the runtime loads:** an
accident. #6812's `:last-child` rule can't see the `::after` placeholder
that holds the Add/Done row's room until the runtime draws it.
- **The comparison's divider, cut at the end of its track:** Web
Awesome's own drawing, which the reading now leaves alone.

**Guidance:**
- `browser/AGENTS.md` now says a round mark stands clear by `--lf-clear`
and never touches an edge. The old wording said a dot keeps its corners
"wherever it stands". Scored with Opus, 3 runs per arm: the old wording
called a dot touching the edge a break 0 of 3 times, the new wording 3
of 3. A thumb, and a field meeting its frame's edge, scored the same
under both.
- `/developing-leaf` now says stills lists the faults a change adds, and
that a change hands over none it can fix. Both versions led the model to
fix the dot before handing over, 3 of 3. Without the sentence it misread
the fault lines as style changes.

**Catalogue states:** a separate commit repairs 11 states that failed on
main, most after a 2-minute timeout, which cost every stills run that
time. `plan-panel-dictating` and `table-scrolled-sideways` now fail in
Firefox within 5 s and say why, because Firefox has no surface for them.

**Size:**
- tooling: +922 / −7, about 280 of it moved from the tests
- tests: +48 / −354
- catalogue states: +80 / −39
- docs: +8 / −4
- lint config: +11 / −5

**Tests:** these ring-helper tests pass, run by node id:
-
`test_panes::test_a_pane_bodys_ring_is_drawn_whole_against_the_workspace_edges`
-
`test_rings::test_the_focus_sweep_distinguishes_stops_inside_a_live_frame`
- `test_threads::test_the_thread_walk_stops_at_each_unsent_comment`
-
`test_card_reply::test_next_on_me_rings_the_options_a_card_message_asks_with_whole`
-
`test_focus::test_the_keys_into_and_out_of_a_panel_thread_land_where_keys_act`

All 5,721 browser and journey tests collect. ruff, ty, eslint, oxfmt,
vulture, typos and knip pass.

> _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