Repository navigation
Draw every mark round a box as the box's own outline, brackets included - #5306
Conversation
notes/browser-support.md, "Recording and assessing a gap", now says when Leaf's code corrects an engine's gap: only where a path users take often shows it, or where it loses something the section already says needs a fix. A correction is a second answer to what the browser decides, which every later change keeps working and someone has to delete once the engine catches up. Where engines differ on one feature and another does the job alike in every engine, the second is used. browser/AGENTS.md points there from its feature-detection rule. The transforms entry now records that its offset walk runs when a box is placed, so an animation that slides the target afterwards leaves the box where it started in Firefox 157 (build 1555) until the next scroll, resize or layout signal. That gap is accepted under the rule, since no example page shows a mark through such a slide.
…e box they mark For #17's comparison only. Each mark is the box's own outline, standing where the box says; a gesture's mark clips the middle of the outline's top and bottom runs into brackets where the band stands outside the box, and draws whole where it stands inside. The overlay boxes are no longer drawn; their code is left in place.
For #17's comparison. The aim, trace, proxy and location ring become a class on the box they mark, and comment marks a data-lf-mark attribute; their stands, shapes, side gaps and faces go. The design label keeps a stand of its own beside the aimed box.
… keep them For #17's comparison. The bracket clip no longer stops at the box's edge: round a box whose mark stands inside, the middle of the band shows what stands behind the box's own edge, and the brackets stay.
# Conflicts: # dist/kernel/kernel.json
…shapes, and inset a workspace body's marks A comment's brackets on a box take the focus ring's band, as the overlay drew them, and only an action's target alone the quieter 1px contour. A mark on a drawing's group strokes the shapes it holds rather than outlining the group's box. A full-height workspace's body fills the window, so it states its marks one band inside it: its question's ring had lost its top and foot to the window. The contract prose in tokens.css, the themes reference and the browser-support note now describe marks the box draws, and css-anchors.js drops the outset only the overlay marks wrote. The aim stills state waits for the box's class.
A drawing's own stroke rule outranks the kernel's, so stroking a marked group's shapes drew nothing on pr-walkthrough's diagram. The part's outline, at its edge with no brackets or veil, is what no drawing sets, and stands where the overlay's contour did for a rectangular node.
… shows, in variables of its own From review: a page rule turning a box's outline off, as a focus-ring reset does, hid its marks, so the mark's outline is important while it shows. An element with no box, such as a section styled display: contents, now has each box it shows through marked, as the location ring already did. The mark's gap, band, ink and room are registered --lf-band-* properties that don't inherit: --lf-mark-w already named the chrome's 16px leaf, which a widget inside a thread card inherited as a 16px outline, and a focused box inside an action's target inherited the target's quiet line. The design label stacks over the chrome's surfaces where what it names stands in one.
…ghlight, and keep a worn focus ring whole From the second review: a marked element whose boxes a layout change replaced, such as a display: contents section's child, left its replacement unmarked, so the layout pass reads the aim, trace and proxy marks' boxes again with the location ring's. A forced palette drew a mark over a focused draft in black where its focus ring is Highlight, so marks take Highlight there. A box wearing the focus ring for a control directly in it, as a choice does for its radio, keeps that ring whole rather than cutting it into a mark's brackets.
…it, and paint a table's names ground only while columns pass under it From the stills over the mark states: a focused comment note rang its row or paragraph in the trace's grey, since the box wears the trace and the proxy ring at once and the trace's ink rule won; any mark in the accent now keeps it. A table row stood its marks a region's gap outside it, where the table clips, as cells already stood theirs inside. The sticky names column painted its ground at all times, so it covered the row's mark across the names; it now paints it only while columns lie under it (data-lf-more-before). --target-trace-w had no reader left. Comments that still described marks projected over the target now describe the box's outline.
The tests that read the overlay's boxes (.lf-aim, .lf-target-trace, .lf-visual-mark, .lf-location, .lf-proxy-ring) now read the marked box itself: its class or data-lf-mark, and its computed outline through one reader, MARK (render_cases_layout.py), which returns the outline's style, width, colour, offset, whether a clip-path cuts it to brackets, and the rectangle its outer edge stands on. focus_rings.js leaves a box out of the ring readings while its clip-path cuts its mark to brackets, and reads a focus-state mark, the proxy ring and the location ring as rings their boxes draw. Behaviour these tests no longer hold, because the branch changed it: - A drawing's part is marked on the edge of its box; no mark follows a diamond's sides or rebuilds a copy of the part's geometry (two contour tests and the same-bounds rebuild test deleted). - The aim stands in no anchored frame, so the tests that a held aim in a pane paints in the frame its target scrolls, stands anchored to what it outlines, and follows a scroll in a widget's shadow stage are deleted: the box's outline moves with the box. - A box that clips the marked element cuts the mark as it cuts the element: the aim on a row a clip packs, and the location ring round a question a frame clips flush, no longer stand inside (two tests deleted; the scrolled-port half of the shared-boundary test and the flush-edge half of the shadow surface test dropped). - A page's own outline on a marked box is covered while the mark shows and returns after it, since the mark's outline is important (the dashed-outline check inverted). - A question filling a full-height workspace wears its ring one band inside it, over the first 2px of its heading's words; the clear-of-its-words test now checks only that the ring stays in the window there. - An element with no box is marked on each box it shows through, so a boxless obligation's slots each wear the ring rather than one ring round both. The note-ring test also checks that a block wearing the trace of a note the keys reached is ringed in the accent, which fails without the rule that keeps it. The two redraw tests strip lf-proxied from their copy, which before carried the class over and passed with the runtime doing nothing. The unused shadow-scroller fixture is deleted.
…+ clear of its brackets From the stills over the mark states, two looks the overlay had and the box's outline lost: - A drawing's part wore its mark as an outline round its box, a square frame off a rounded node's ends and round a diamond's empty corners. Each shape the part draws now takes the mark as its stroke, important as the outline is, since a drawing's own stroke rules outrank any other; its words keep their own paint. The part draws no outline. Tests read the shapes' strokes (DRAWN_MARK), and the rounded node's test now checks the mark follows its edge and gives its border back after. - A diff line's comment press drew its + chip over the line's left edge, where a mark on the line draws its band, so the line's draft lost its left bracket. The chip now stands one band in from the line's edges; the diff test checks it stands clear of the draft's band, which fails with the chip back at the edge.
# Conflicts: # dist/kernel/kernel.json # dist/kernel/leaf.js # dist/kernel/runtime/bundle-box-motion.js
…e it Inside the body, one band in, the location ring round a question filling the workspace ran over its heading's first letter and passed under the panes it holds, which paint over their holder's outline. The workspace leaves the body its gutter on top and at the sides, too little for a region's gap and enough for a control's, so its marks stand there; the run along its foot falls below the window, which the body meets. The question test checks the ring stands outside the body, clear of its words, inside the window on top and at the sides.
# Conflicts: # browser/runtime/annotation-overlay/visual-mark-paint.js # browser/runtime/chrome.css # browser/runtime/target-paint-geometry.js # browser/runtime/target-paint.js # dev/leaf_dev/commands/stills.py # dist/kernel/kernel.json # dist/kernel/leaf.js # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-box-motion.js # dist/kernel/runtime/bundle-content-layout.js # dist/kernel/runtime/bundle-page-layout.js # tests/browser/controls/test_rings.py # tests/browser/margin/test_clusters.py # tests/browser/margin/test_opening_threads.py # tests/browser/margin/test_page_map.py # tests/browser/margin/test_status.py # tests/browser/navigation/test_key_scopes.py # tests/browser/navigation/test_obligation_walk.py # tests/browser/test_render_aim.py # tests/browser/test_render_anchors.py # tests/browser/test_render_margin.py # tests/browser/test_render_pages.py # tests/browser/test_render_reactions.py # tests/browser/test_render_semantic_selection.py # tests/browser/widgets/test_obligations.py # tests/journeys/test_render_reactions.py # tests/render_cases_interaction.py # tests/render_cases_layout.py
leaf-agent
left a comment
There was a problem hiding this comment.
The press reach on Leaf's small buttons collapses to nothing. f6409c970 changed both reach rules in surfaces.css from inset: min(0px, (100% - var(--aim-floor)) / 2) to inset: (100% - var(--aim-floor)) / 2. Outside a math function that value isn't valid CSS. Because it contains var(), it becomes invalid at computed-value time instead of being rejected at parse time: inset falls back to auto, and the ::after reach is a 0×0 box at its static position. That rule covers .lf-btn, .button, icon, inline, mark and answer buttons, and the ::part(button) rule on Copy.
I checked it in Chromium with --aim-floor: 44px on a 20px button. With the new value the ::after computes to 0px × 0px, and with min(...) it computes to 44px × 44px at -14px. With the reach gone, every one of these controls smaller than the floor takes a press only on its face, which matters most on touch. Only the journeys tier's aim sweep (tests/page_scripts/aims.js) presses a reach's ends, and the PR body says that tier wasn't run.
Nothing in the commit message mentions the reach, so the suggestions below restore min(...). If the change was meant to also shrink the reach of a button larger than the floor, it would need calc(...).
…ine height, and read a diagram part's proxy ring off its shapes From review and CI on #5306: - A prototype commit's sweep of the bracket clip's min() also dropped it from the two press reach rules, `inset: min(0px, (100% - var(--aim-floor)) / 2)`. Without it the value is invalid at computed time, inset falls back to auto, and the ::after reach of every small button collapsed to nothing, so a control smaller than the touch floor took a press only on its face. - The diff line's + named a line height of its own, which the interface's font rule refuses; it now centres in its shorter box by grid. - The visual proxy test read the outline a drawing part no longer draws; it reads the shapes' stroke.
#5524) Since #5306, a focused page control wears `data-lf-mark="focus"`, and the mark rule in `surfaces.css` drew 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: - An author's `#candidate-input:focus {outline: 4px solid violet}` on a playground candidate read `2px` (`test_playground_controls_take_focus_from_editors_and_keep_candidate_focus`). - The trace canvas is a ring overlay. It turns its outline off and rings itself with an inset `::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 `!important` outline. **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 stills` for `trace-image-keyboard`, `playground-text`, `playground-choice`, `gallery-tab-focus` and `proxy-drawing` came 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 `!important` so 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-sixty` whether focus should keep that guarantee. **Verification:** both tests fail on `a6fefaa77` and 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 in `controls/test_rings.py`, two `controls/test_focus.py` tests, the mark-contour tests in `test_render_anchors.py`, and all of `test_render_playwright_trace.py`. Closes #5478 — automated triage Co-authored-by: leaf-agent <[email protected]>
…ept two ring cuts #5306 and #5614 chose (#6200) After #6193's sample updates, `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` still reported eight ring faults, which earlier failing samples had hidden. They have three causes. This PR fixes the one that is a real defect. For the other two, it updates the ring reader to accept outcomes that #5306 and #5614 chose on purpose. With this change the journey passes on main `3bc561561`. Without it, a tab walk over data-explorer, code-comparison and review-a-fix on that commit still reports all three kinds. **The trace's metadata scroller covered its own ring (review-a-fix).** `.lf-trace-metadata` wears its ring one band inside its edge, but it had no padding. Once #5306 drew every mark as the box's own outline, the scrolled words painted over the ring's left run. The scroller now starts its words a ring's room (5px) in, as the token's rule for an inset ring expects (`tokens.css`, "Where it stands"). On screen, this changes the review-a-fix trace's metadata pane: its text moves 5px right, and its focused ring's left edge shows whole.   **A full-height question's mark runs below the window (data-explorer, notification-playground, shadow-scale).** #5306 says so in its description: a question filling a full-height workspace wears its ring 3px outside itself and reaches the window's foot, "so the ring's bottom run falls below the window". `browser/AGENTS.md` rules out padding the page for a mark. The reader now skips that bottom run when the ring belongs to a box that isn't focused, isn't fixed, and ends the page at the window's foot. The focused control's own ring is still held to the foot. So is a fixed box: `test_the_ring_reading_sees_and_measures_a_ring_cast_as_a_shadow` plants an unfocused fixed box there and still passes. **A focus preview covers the question around its control (code-comparison, command-hub, motion-playground).** Since #5614, a keyboard step onto a control shows its preview. The preview stands clear of the control and of the controls the user could work next, and may cover the rest of the page. Here the "Show instruction" and "Copy Markdown" previews lie over the enclosing question's location ring. The reader no longer samples another box's ring under an open `#lf-preview`, but it still reads the focused control's own ring there. <details><summary>How each cause was dated</summary> The test's last pass in a scheduled run was `7cbf67854` (Oct 27). Runs from Oct 28 to Nov 3 failed on earlier samples, and the Nov 4 run already listed the full-height and trace faults. I ran `git bisect run` over a tab walk of the affected examples: - data-explorer and review-a-fix: first bad commit `ecf4dc10d` (#5306), clean at its parent `5bdc6fa9b`. - code-comparison: clean at `ecf4dc10d`, first bad commit `4248d1f4c` (#5614). Checks run on the branch: the journey itself, `tests/browser/controls/test_rings.py` (27 passed), and `tests/browser/test_render_playwright_trace.py`. In that last file, `test_trace_tree_opened_by_the_browser_keeps_its_match` failed once under `-n 3` on this branch. It also fails under `-n 3` on unchanged main, with the same row position (480 against a 12–111 band), so this change doesn't cause it. </details> Closes #6192 — automated triage Co-authored-by: leaf-agent <[email protected]>
…has none (#6408) Next On Me drew the location ring round an option group asked alone in a thread message 6px off the group's frame, while the ring round a question on the page stood 3px out. Neither box stated `--lf-ring-at`, so both took the press list's guess in `surfaces.css`: the thread's `lf-options` has no role and fell to a region's gap, and `lf-group`'s `role="group"` matched the list's `[role]` (#5306) and took a control's. This PR has each box state its kind in the rule that draws it. The joined option group draws a frame, so it states 0 and its ring lies on the frame, as a field's does. A named group draws nothing, so it states a region's gap. The taxonomy in `tokens.css` states the rule for any box that draws a frame round itself, naming no widget, and lists the named group with regions. **Decided:** Max chose this on a design page: the ring on the frame where a question has one, and 6px where it has none. It replaces the 3px for every question that an earlier commit on this branch drew. Firefox stills against main, 2x: | | main | this PR | |---|---|---| | Option group asked alone in a thread: 6px → on the frame | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/card-main.png" width="368"> | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/card-frame.png" width="368"> | | Question on the page: 3px → 6px | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/page-main.png" width="400"> | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/page-region.png" width="400"> | | Group asked in a thread message: 3px → 6px | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/group-main.png" width="348"> | <img src="https://gist.githubusercontent.com/max-sixty/00b1770c53be995e91166c06707a6918/raw/19be90497310b01f327b7a7ed1b9e741fbc92850/group-region.png" width="348"> | The named group has to state its gap, since `[role]` would otherwise give it a control's; narrowing the press list to roles that take a press is a separate change. Tests: the ring-kind model test, `test_current_location.py` (its choice's arrival ring now reads 0) and the ring and aim tests that use groups pass. Stills of ten question states in Firefox change pixels only in the four states that show these three cases; the rest change computed `outline-offset` on unringed groups. The new stills state `plan-card-choice-keyboard` reaches an option group asked in a thread card. > _This was written by Claude Code on behalf of max-sixty_
Every mark Leaf puts round a box of the page is now that box's own outline: the Alt aim, the margin trace, a comment's mark, the proxy ring and the location ring. Brackets are the same outline with the middle of its top and bottom runs clipped away by the box's own
clip-path. The overlay that drew these marks in Leaf's chrome, and the anchoring, side gaps and repaint triggers that kept it on its target, are gone. This branch also records when Leaf's code corrects a browser's gap.Why
The overlay had to follow each target, and CSS anchor positioning, which moved it, still differs between engines:
notes/browser-support.mdrecords Firefox ignoring a stuck sticky anchor and an anchor's transforms, WebKit adding the root scroll under a fixed box, and both misplacing a scroll inside a scaled box. Where anchoring fell short, Leaf measured again on a scroll, resize or layout signal, a list no browser event can complete. In Firefox, an aimed paragraph slid by an animation left the aim where it started. A box's outline moves with the box through any motion in every engine, so that class of bug goes for marks round a box. Pins, margin rows, chips and thread cards still stand beside their targets through anchoring.What changed for the user
browser/AGENTS.mdrules out padding the page for a mark.How it works
browser/styles/components/surfaces.cssholds every mark rule, keyed on.lf-aimed,.lf-traced,.lf-proxied,.lf-projected-locationanddata-lf-mark. The outline stands at the box's--lf-ring-at, and is important so a page rule turning a box's outline off doesn't hide the mark. The band's gap, width, ink and room are registered--lf-band-*properties that don't inherit. A drawing's part draws no outline: each shape it draws takes the mark as its stroke, important for the same reason.browser/runtime/target-paint.jsputs each mark's class on every box its element shows through (shownParts) and reads them again on layout. Only the design label still stands in the chrome beside the aimed box.browser/runtime/annotation-overlay/visual-mark-paint.jswritesdata-lf-markfrom the comment states anchor paint supplies.browser/runtime/target-paint-geometry.jskeeps only the paint stands and sets the remaining painters use.browser/layouts.cssstates a full-height workspace body's marks at a control's gap, andreading.cssa table row's one band inside it, as it already did a cell's. A table's sticky names column paints its ground only while columns pass under it, so at rest a row's mark shows across it.notes/browser-support.md, "Recording and assessing a gap": a gap is recorded with a recheck and corrected in Leaf's code only where a path users take often shows it.The browser code loses 952 lines and gains 397, comments included; the tests lose 1,203 and gain 574.
Tests
The tests that read the overlay's boxes now read the marked box: its class or
data-lf-mark, and its computed outline through one reader,MARK(tests/render_cases_layout.py). Tests of behaviour the branch removes are deleted, each named in the commit "Read every mark off the box that draws it": the copy of a drawing part's geometry the overlay rebuilt, the aim's anchored frame in a pane, and marks standing inside a box that clips their target flush. Three checks fail with their fix taken out: a block wearing both a note's trace and its proxy ring is ringed in the accent, a diff line's + stands clear of its draft's band, and a rounded diagram node's aim runs along its edge and gives its border back after.Run locally on the branch merged with main: the rewritten and nearby browser tests by name (about 120, in Chromium, with
test_scrollersin all three engines),pnpm run check, andpnpm run test:runtime(764 pass).leaf-dev stillsover 18 mark states against main: 9 draw identical pixels; the rest differ by the changes above. Not run locally: the journeys tier, including the corpus aim sweep and the tab walk over every example's focus rings. Three tests fail here and on main alike:test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[combined-selection],test_an_aimed_comment_keeps_its_place_with_on_me_open(the chrome's root is positioned) and the journeytest_a_data_bound_diff_aims_and_selects_one_source_line(a selection's anchor now carries its prefix and suffix).