Skip to content

Styles are incorrectly added when component is started inside the Shadow DOM #225

@adharris

Description

@adharris

Describe the bug
When the component is rendered within the Shadow DOM instead of in the main page, the CSS styles are still attached to the document head rather than within the shadow root. This means that any styling defined in ./src/style.css is not applied.

Furthermore, since style.css is inlined into the build output, and not included in the distributed package, I can't explicitly include the styles myself inside the shadow root. (Doing so would 2x include the styles, but bundle size isn't a big concern for my use case).

Expected behavior
The stylesheet is added to the shadow root rather than the page head element, though this strikes me as a breaking change.

Maybe a separate build that doesn't include the styles, and instead requires importing the stylesheet manually?

Screenshots
Image

Online demo
https://codesandbox.io/p/sandbox/json-edit-react-demo-forked-pvph9n

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions