Repository navigation
Declare stylesheet access instead of inferring selector intent - #2997
Merged
Merged
Conversation
Ordinary page and theme rules stop at chrome and generated controls through a native scope boundary. An explicit authored scope grants access, replacing selector-name inference and the selector list parser. Migrate deliberate example styling and author guidance together. Browser tests retain generic-rule protection, imports and dynamic rewrites, and now use explicit scope for deliberate control styling. The authoring instruction comparison passes 3/3 on the candidate and 0/3 on the former contract.
Parse and serialize each layer source before wrapping it, so CSS EOF recovery cannot swallow later layers. Keep authored style elements independent for validation, dependency capture and corpus generation. Remove css-unclosed and accept the browser recovery it attempted to police. Correct only tinycss2 surrogate escape output to CSS-required U+FFFD before UTF-8 encoding.
…tive-page-css-scope
Keep stylesheet attributes in SourceDocument and carry them through corpus hoisting and export. Stylesheet nodes are native CSSOM owners: a changed source declaration reparses its original rules, including a body-only access grant or withdrawal. Keep stylesheet load handling in its one owner. Focused browser coverage proves grant and withdrawal through live revisions; source/export/corpus tests protect metadata preservation. Independent review found the earlier gaps and confirms they are fixed.
# Conflicts: # dev/leaf_dev/commands/corpus.py # skills/leaf/scripts/leaf/structure.py
leaf-agent
approved these changes
Oct 15, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 15, 2026
#2997 made stylesheet access to Leaf controls explicit. That left PhotoSwipe's runtime stylesheet, which Leaf appends inside its image dialog, subject to page CSS filtering. Its positioning rules no longer reached the viewer, so the fitted image appeared below the stage. Mark that sheet `data-controls` before attaching it. Browser probes that deliberately style Leaf controls now declare the same access, preserving their original assertions. This addresses 16 failures in the [main CI run](https://github.com/max-sixty/leaf/actions/runs/38700868252). The two other failures in that run were separately repaired by #3003 and #3005; their current tests pass. The 16 affected browser cases pass locally, including both online and exported image previews, compositor frames, the corpus stylesheet-order gate, and control styling. `pnpm run check`, 487 runtime tests, and changed-file pre-commit checks pass. Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 15, 2026
The [scheduled main run](https://github.com/max-sixty/leaf/actions/runs/38723388285) failed response inset, focus-ring, and scaled-panel checks whose test styles tried to change Leaf controls without the stylesheet access marker introduced by #2997. Leaf correctly narrowed those selectors, so the claimed inset, deliberately missing rings, and panel scale never reached their controls. These test styles now declare `data-controls` before they attach, preserving the checks while respecting the explicit access boundary. The two response inset cases, missing-ring case, and scaled-panel case failed before their fixes and pass locally afterward. --------- Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Page and theme CSS currently infer permission to style Leaf controls from selector spelling. Negated widget names can leak, while selectors nested in constructs such as nth-child can be misclassified.
Replace that inference with explicit stylesheet access: page style/link elements use
data-controls, and theme packages put deliberate control styling incontrols.css. Ordinary selectors retain the existing weightless subject exclusion, preserving root variables, ancestor conditions, pseudo-elements and cross-sheet cascade behavior. Native CSS scopes keep their normal meaning. Widget packages continue styling their own controls through their existing theme sheet.Carry stylesheet attributes through the canonical source reading, corpus composition and export. A changed stylesheet declaration rebuilds its native CSSOM owner, so a body-only access grant or withdrawal takes effect during a live revision. Update the author contract, examples, core gallery and authoring evaluation together.
Validation: independent review and follow-up review are clean; four focused browser tests, nine focused model checks, 493 runtime tests, changed-file pre-commit and browser bundle checks pass. Root/ancestor/pseudo-element/cascade controls pass Chromium, Firefox and WebKit. The instruction comparison passed 3/3 candidate trials versus 0/3 base trials. Four existing visual states are unchanged; the gallery adds the access demonstration. Startup adds no code requests and reduces JavaScript payload by 685 bytes.