Skip to content

Draw a light widget's box before its authored children - #7572

Merged
max-sixty merged 5 commits into
mainfrom
agent-af3a9bc542ba139c4
Nov 29, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-af3a9bc542ba139c4

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

defineWidget now puts the display: contents box a light widget draws in before the element's authored children instead of after them. Reading and focus order put the drawing there: a tab strip, a deck's bar, a comparison's chooser, a motion study's transport or a worktree list's totals. Until now, a widget that draws before its members could only get that order from a shadow root. A revision that patches a markup widget's children in place (lfPatch: "members", no views) places authored nodes after the runtime's leading nodes. With the box last, a member added at the end landed after the drawing. A new effect-widget test checks that adding and reordering members keep the drawing first; it fails with append.

lf-worktree-diffs drops its shadow root, slot and registry shadow key. The Renderers rule now allows a shadow root only where a widget draws on both sides of its children or around them. lf-motion keeps its root: its DriveStudy Mount reads the previews through the slot, hears revisions by slotchange and catches input on the slot, and 11 ::part() rules would have to become classes.

Stills of the 12 states that reach a light widget show 0 px change in Chromium, and so do the worktree and draft states in Firefox. In a draft whose words hold a link, Tab now reaches Edit and Copy Markdown before the link instead of after it (leaf-dev probe).

pnpm run check and the worktree and motion browser tests pass; leaf-dev interface --base adds and removes no name. Asked for by the maintainer through the Effect UI migration; Codex reviewed it.

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

Not for main: a prototype for the maintainer's pick of where defineWidget's
box goes (one line, #box: prepend instead of append), with the header's
contract sentence to match.

A revision's member patch places authored nodes after the runtime's leading
nodes (dom/dom-children.js, order), so a leading box stays first; a trailing
box ends up between old members and one a revision appends
(scratch-box-order.test.mjs). pnpm run test:runtime passes (1250); stills of
the five light ported widgets' twelve states show 0 px change in Chromium.
… shadow root

Not for main: shows a widget that draws before its authored members porting
without shadow: true once defineWidget's box stands first. The overview is
the view's root; the registry's shadow key, the slot and the slot's CSS go.
Stills of worktree-startup, -summaries and -cases-open: 0 px change; styles
differ only by the overview moving out of the root, and the members now
inherit the collection's 16px column gap as worktrees.css meant
(column-gap: inherit), which the slot had broken. The capture test reads
the overview in light DOM and checks it stands before the members.
…te the rule

The effect-widget test patches a light widget's members as a revision does
(add at the end, add at the start, swap) and checks the drawing stands
first each time; it fails with the box appended. Renderers and
module-widgets.md say the box stands before the authored children, and that
a decorating widget takes a shadow root only where it draws on both sides of
them or around them.
…credited slots

lf-call-diff's header no longer says its box follows the authored content;
the worktree grid comment says the overview and members share one grid; the
effect-widget test says which widgets a revision patches in place.
@max-sixty
max-sixty merged commit 8320f63 into main Nov 29, 2026
7 checks passed
@max-sixty
max-sixty deleted the agent-af3a9bc542ba139c4 branch November 29, 2026 00:19
max-sixty added a commit that referenced this pull request Nov 29, 2026
Drawing a widget's box before its authored children (#7572) put the gloss's
proxy, a transparent pixel out of flow, ahead of the phrase, at the top of
the line box 3 px above the words. Chrome counts that pixel among the
gloss's boxes, and Playwright aims a click at the first of them, so every
click on a gloss in the suite and in the gloss-open still landed on the
paragraph around it and timed out.

The proxy now stands at the phrase's first corner, inside it, so every box
the gloss has lies on its words. Nothing a user sees changes: the pixel is
transparent and takes no pointer.
max-sixty added a commit that referenced this pull request Nov 29, 2026
…s view

Main now draws a light widget's box before its authored children (#7572), which put a
card's phone buttons above its title and pushed every title below the grip's room. The
card draws on both sides of its words, so it takes a shadow root, as the Renderers rule
says: the grip before the slot, where it stands in the card's top corner, and the Move to
buttons after it. Its rules move to styles/card-shadow.css under `:host(lf-card)`. A
screen reader now reads the grip before the card's title; stills of the board at rest,
grabbed, moved and moved on a phone show 0 px against main.

Margin layout read a shadow host whole as cover even where the host was the pin's own
target, so a comment pin by a card stood above it, over its column's count. The walk now
crosses the target's own shadow tree, as it crosses those of the hosts holding it; the
board case of the pin catalogue caught it.

The grip draws its symbol face with `actionPress` and states the board's rows with
`Keys`. The rows stay functions the board makes, since a row's `message` reaches the
component that drew it. module-widgets.md says how Mount args compare on each draw and
that two Mounts' messages reach `update` in no fixed order.

The page-CSS tests read a draft's controls, since a page's rules don't reach the cards'
shadow trees, and the module test serves a page with no shadow widget for the case that
never asks for shadow.css.
max-sixty added a commit that referenced this pull request Nov 29, 2026
…tands in

A light widget's box now comes first among its children (#7572), so the
gloss's first child node is the box, not the phrase. Three reads in
test_contents_and_glosses took childNodes[0] for the phrase and measured
the box instead (the 144 px gap CI reported). They now find the phrase's
text node; the behaviour each protects, where the phrase sits and what
selecting it selects, is unchanged.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 29, 2026
…ext frame finds them (#7578)

A drag released over the page's chrome puts back the words it held while
the hand was still on them. That put-back ran a frame later, with the
snap, so a key pressed first, such as `c` to comment, read the browser's
own selection and cancelled the deferred put-back. This went unseen
while every widget drew after its words, since the browser's far end
then still held them.

Drawing a light widget's box first (#7572) put the draft's toolbar
before its words. A drag along a draft's line released over its Copy
button now leaves only a newline selected, so `c` opens no comment box.
`test_saved_widget_words_cannot_dismiss_an_unfinished_comment` has
failed on main since #7572 (bisected: it passes on #7572's parent).

The release now puts the range back and remembers it at once, as a
release inside the words already did; only the snap waits for the frame.
That covers any widget whose drawing stands before its words, such as a
tab strip.

Tests: the draft test and the drag-overshoot tests in
`test_render_anchors.py` pass, and `pnpm run test:runtime`. A probe of
the same drag then `c`: in Chromium, main ends holding a newline and
opens no box, and this branch holds the words and opens it; Firefox,
whose selection never ended on the toolbar, opens it on both.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 29, 2026
… it (#7590)

A draft whose words open with a code block lost its Edit button to the
code block's Copy. #7572 drew a light widget's box before its authored
children, so the draft's toolbar now stands before its words in the
tree. The code block's Copy takes the same top-right seat at the same
`z-index: 1`, comes later in the tree, and so paints over Edit and takes
its presses. The toolbar now stacks at `z-index: 2`, which restores how
the corner painted before #7572.

`test_crossed_responses_wait_for_the_same_thread_widget_module` timed
out clicking Edit (`<wa-copy-button …> from <div class="lf-draft-body
…"> subtree intercepts pointer events`) in [run
46209069029](https://github.com/max-sixty/leaf/actions/runs/46209069029).
Locally it passes on #7572's parent `2e0b08a79`, fails on #7572
(`8320f6326`) and on current main (`80c18fe78`), and passes with this
change.

On screen, this changes only the hovered or focused corner of a draft
that opens with a code block. Hovering the draft's words in the test's
reply, before and after:

![before: the code block's Copy covers the toolbar's
Edit](https://github.com/user-attachments/assets/57b06562-0279-4d71-8a98-34523034ba9f)
![after: the toolbar's Edit and Copy stand over the code block's
Copy](https://github.com/user-attachments/assets/0cce406f-8803-418c-af04-753675fcae6d)

The point at Edit's center hits the code block's Copy before and Edit
after. `leaf-dev stills` for `release-draft`, `release-draft-hover` and
`plan-marks-draft` shows 0 px change. The code block's Copy still shows
below the toolbar's edge, as it did before #7572.

Refs #7588 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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