Skip to content

fix: preserve stylesheet base URL in shadow roots - #10746

Open
cdeil wants to merge 1 commit into
marimo-team:mainfrom
cdeil:codex/fix-safari-shadow-stylesheet-base-url
Open

fix: preserve stylesheet base URL in shadow roots#10746
cdeil wants to merge 1 commit into
marimo-team:mainfrom
cdeil:codex/fix-safari-shadow-stylesheet-base-url

Conversation

@cdeil

@cdeil cdeil commented Sep 3, 2026

Copy link
Copy Markdown

This pull request was authored by a coding agent.

📝 Summary

When copyStyles serializes a linked stylesheet into a constructed stylesheet for a component shadow root, WebKit resolves relative font URLs against the document directory instead of the source stylesheet. Nested static exports therefore request bundled fonts from the lesson root and receive 404 responses.

This change:

  • constructs each copied stylesheet with baseURL: sheet.href ?? document.baseURI
  • covers both linked and inline stylesheets through the real registerReactComponent path

CSSStyleSheetInit.baseURL is the CSSOM mechanism for setting the base URL used to resolve relative URLs.

🔬 Verification

  • Red: the two new regression cases fail on unchanged current main; the 14 existing focused tests pass.
  • Green: all 16 focused tests pass after the production fix.
  • Full make check, frontend lint, type-check, and production build pass.
  • Nested html-wasm export:
    • Safari 26.6.2: 9 wrong-base font requests before, 0 after
    • Playwright WebKit 26.5: 9 before, 0 after
    • Chromium 151: 0 before and after

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marimo-docs Ready Ready Preview Sep 3, 2026 7:10pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cdeil

cdeil commented Sep 3, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 participant