Fixed: Scope injected styles to Diva's root to prevent global style leak - #565
Merged
Merged
Conversation
The injected <style id="diva-inline-styles"> element carried two
page-wide rules — `* { box-sizing: border-box }` and
`:root { color-scheme: light }` — that altered every element and the
color scheme of the host page. Scope both to the .diva-app tree.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Member
|
I’m fixing this in a separate bit of work. I’ll keep this open to remind me tho |
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.
Problem
diva.js injects its stylesheet into
document.headas<style id="diva-inline-styles">. Two rules in it were unscoped and therefore affected the entire embedding page, not just Diva:* { box-sizing: border-box }— reapplied the border-box model to every element on the host page, shifting the layout of any component that relied on the defaultcontent-box.:root { color-scheme: light }— forced the document's color scheme, overriding host dark mode and changing native control rendering.Fix
Scope both rules to Diva's own root (
src/styles/app.css):.diva-appand its descendants only;color-scheme: lightmoved from:rootonto the.diva-apprule.