Skip to content

Keep the page's reading face in a shadow tree's slots, and .lf-ui border-box there - #7447

Merged
max-sixty merged 2 commits into
mainfrom
effect-ui-core-reading-face
Nov 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
effect-ui-core-reading-face

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Requested by Maximilian · project thread

Part of the Effect UI core pass: a declared shadow tree's slots keep the page's reading face, and its .lf-ui controls size at their border, so decorating widgets stop restoring either on their own.

Reading face. reading.css set :host { --lf-reading-face: initial }. That kept a widget's own drawing out of markup's face, but slotted author content inherits through the host, so it lost the page's face too. lf-motion and lf-options each put --lf-reading-face: inherit back on their host. Now the host keeps the page's value and hands it to its slots (--lf-host-reading-face); the reset sits on the tree's top-level elements other than slots, and each rule has zero specificity so a widget's sheet or the transcript rule can still set the face on its own elements. Both per-widget workarounds are gone.

.lf-ui box-sizing. chrome.css's .lf-ui border-box reset reaches only the document. controls.css, which every declared tree reads, now states it for shadow trees (:where(:host .lf-ui …)), and options-shadow.css drops its own copy.

Visible differences, from leaf-dev stills --base origin/main over the option, motion, worktree, file-tree, diff and file-editor states:

  • lf-options / lf-motion: the controls they draw (the add field's error line, the add and play icons) no longer wear the reading face's prose rules (p text-wrap, svg vertical-align). The rendered crops show no pixel change.
  • lf-worktree: on a reading-face page, the first worktree's slotted notes and facts now wear the page's face, as the later ones already did. worktrees.css gave the later ones --lf-reading-face: 1 on the host, which, because a document rule on a host beats :host, also put the face on their drawn summary and path. That declaration is gone, so every worktree's drawing is the same. The first worktree's facts block sits 11px higher.
  • lf-file-tree, lf-diff, lf-file-editor: their .lf-ui boxes are border-box, as they are in the document. The file tree's search field is about 6px shorter.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y

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


Generated by Claude Code

…der-box there

A declared shadow tree reset `--lf-reading-face` on its host, so the author
content it slots lost the page's face, and lf-motion and lf-options each put
it back on their host. The host now keeps the page's value and hands it to its
slots; the reset sits on the tree's own top-level elements. Both workarounds
go, and so does worktrees.css's face on every later lf-worktree host, which
made later worktrees draw differently from the first.

controls.css states the `.lf-ui` border-box reset for shadow trees, which
chrome.css states for the document alone, so options-shadow.css drops its copy.
lf-file-tree, lf-diff and lf-file-editor's `.lf-ui` boxes become border-box.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y

@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.

The top-level reset can't be undone from a widget module's own sheet, which contradicts both the new comment in reading.css and the promise in skills/leaf/references/module-reading.md, "Code": "a block in a shadow tree wears it where the widget sets --lf-reading-face: 1 on a box around it".

A declared tree reads shadow.css in lf-shadow (composed_sheets in src/leaf/source/layer.py). The stylesheet a module writes itself goes in lf-base (inBaseLayer, and module-authoring.md tells authors to wrap it that way). lf-base ranks below lf-shadow, and layer order decides before specificity, so zero specificity on :where(:host > :not(slot)) doesn't help. If a module's sheet sets .root { --lf-reading-face: 1 } on its tree's top-level box, the reset wins, the box loses the face, and dressCode leaves its code uncoloured. Before this PR the reset sat on :host, so the same rule on the box won. Only a package's widget-shadow.css, which follows shadow.css inside lf-shadow, or a box below the top level still gets the face.

No bundled widget hits this today: the only places that set the face from a module are syntax.js reading it and the transcript and Markdown rules later in this sheet. But it is now package-interface prose that misleads a third-party author. One fix is to move the reset below lf-base. Otherwise both texts should say where the face can be set again; the suggestion covers the comment, and module-reading.md needs the same caveat.

Comment thread browser/styles/components/reading.css Resolved
A module's own sheet stands in `lf-base`, under the tree's top-level reset in
`lf-shadow`, so it sets the face on a box inside the top-level element.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
@max-sixty
max-sixty merged commit 2d49456 into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the effect-ui-core-reading-face branch November 27, 2026 22:07
leaf-agent added a commit that referenced this pull request Nov 28, 2026
…ws it (#7506)

#7439 put a drawing part's marks on the frame the part is drawn in
(`markedParts` in `dom/geometry.ts`), and the margin entry's trace is
one of those marks. So hovering the margin entry for the thread on
diagram node U now traces the node's `rect`, not its `g[data-id="U"]`.
`test_threads_on_two_parts_of_a_picture_stand_an_entry_each_tracing_its_part`
still expected the group and has failed on `main` since #7439 landed.
The test now expects the node's frame. It still checks what it was
written to protect: one trace, on that node alone, not on the picture.
Nothing changes in the product.

The test fails on current `main` (`AssertionError: flow`, traced element
`<rect … data-lf-traced>`) and passes with this change.

#7497 names a second test,
`test_native_sidebar_is_placed_before_widget_activation`. It passes at
#7439 and first fails at #7447, so it has a different cause and this PR
doesn't touch it. The issue has the diagnosis.

Refs #7497 — automated triage

Co-authored-by: leaf-agent <[email protected]>
This was referenced Nov 28, 2026
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.

3 participants