Skip to content

fix: style message widgets in a thread seated in a widget's shadow tree - #5945

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5944
Nov 14, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5944

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A package's defaults.css reached only the document. A diff seats its line threads in its own shadow tree, so message markup there lost every package widget's look. An lf-options group drew as run-together inline text. Every declared shadow tree now also takes each package's defaults.css inside @scope (.lf-thread-transcript), in lf-shadow right after that package's widget-shadow.css. That is the same order and tier it holds against the shared sheets in the document. So a message reads the same wherever its thread is drawn, and the widget's own elements pick up none of it. The second symptom came from the render check. Its undeclared-attribute probe refused part, which the runtime itself sets on a box in a shadow tree so the document can anchor it (css-anchors.js). part now joins the platform attributes a module may write, beside class and style.

test_a_widget_in_a_diff_line_thread_wears_its_package_s_look seats the issue's choice in a diff line thread. It checks that the group draws as grid and its options as flow-root, and that the render probe finds no undeclared attribute. It fails on main (display: inline, part refused) and passes here. In that thread the options now measure 16px padding-top and 74px tall, the paragraph-thread values the issue records. tests/model/test_interact_layer.py and the neighbouring diff-thread browser tests pass.

Cost and what this leaves
  • Bytes: with the default, reading and diff packages, the composed shadow.css grows from 129 KB to 232 KB (23 KB → 40 KB gzipped). The default package's widget rules make up most of the growth. A page fetches it once, and only when it has an x-shadow widget (widget-loader.js).
  • Per shadow root: each root gets the text as its <style>. In headless Chromium, 200 shadow roots took 58 ms with the base sheet and 93 ms with this one. That is about 3 ms the first time and roughly 0.2 ms for each further root.
  • A cheaper alternative, if those costs matter: a separate transcript sheet that the runtime adopts only into a shadow root holding a seated thread. That needs a new composed resource and a load step at placement, so it isn't done here.
  • Theme rules: a theme's rules that climb above the transcript, such as body button or html[data-lf-interactive] …, still match nothing inside the scope, as before. The page's own unlayered CSS still doesn't reach a shadow-seated transcript. This PR doesn't change that.
  • Docs: the layering table in skills/leaf/references/packages.md changes with the code.

Closes #5944 — automated triage

A package's defaults.css reached only the document, so message markup in a
thread a widget seats in its shadow tree, such as a diff's line thread, lost
its widgets' look: an lf-options group drew as run-together inline text. Every
declared shadow tree now also takes each package's defaults.css within
`@scope (.lf-thread-transcript)`, in lf-shadow after that package's
widget-shadow.css, the order it holds in the document, so a message reads the
same wherever its thread is drawn and the widget's own elements take none of it.

The render check's undeclared-attribute probe refused `part`, which the runtime
itself gives a box in a widget's shadow tree to anchor it from the document
(css-anchors.js), so `page check --render` failed such a page. `part` joins the
platform attributes a module may write, as a look rather than a state.

Closes #5944
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.

An lf-options choice in a thread on an lf-diff line draws as run-together text, and fails the render check

1 participant