Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DiffViewer inside Shadow DOM #181

Open
VladyslavKvaskov opened this issue Mar 10, 2023 · 2 comments
Open

Use DiffViewer inside Shadow DOM #181

VladyslavKvaskov opened this issue Mar 10, 2023 · 2 comments

Comments

@VladyslavKvaskov
Copy link

VladyslavKvaskov commented Mar 10, 2023

Hello
I use DiffViewer inside shadow DOM
The problem I have is that styles are appended to the document's head, so they do not affect the ui of DiffViewer since it's rendered inside of shadow DOM.
Is there any way to specify the target to which the styles should be appended???

@VladyslavKvaskov
Copy link
Author

VladyslavKvaskov commented Mar 10, 2023

I had to solve it using JS.

React.useEffect(() => {
  const styles = document.head.querySelectorAll('style[data-emotion="css"]');
  styles.forEach((styleElement) => {
    targetElement.appendChild(styleElement);
  });
}, []);

where targetElement is the element you want to move the styles to

@VladyslavKvaskov
Copy link
Author

Using emotion createCache and CacheProvider, a container to which the styles will be appended, could be provided
So please add the ability to specify an element of the container.

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

No branches or pull requests

1 participant