-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Styles should work with ShadowDOM roots. #1517
Comments
@necolas I was able to get a solution working where I add a style node as a child whenever mounting a new shadow DOM node. After that I added this functionality to
I saw that |
@necolas any chance you could give us some brief thoughts or guidance on this one? |
See #2208 for a build that should support ShadowDOM use |
* Improves React Native compatibility by making StyleSheet.create the identify function. * Improves React 18 support by inserting styles on eval. * Supports use with multiple windows (i.e., iframes) and shadow roots. * Supports nested LTR/RTL layouts. * Supports 3rd party compilers and extraction to static CSS. * Fixes static and dynamic short/longform deduplication. * Reduces browser support: Safari 10.1+, Chromium Edge, no IE, no legacy Android browsers. * Removes automatic vendor-prefixing of inline styles (for better perf). * Removes focus-visible polyfill as modern browsers no longer show focus rings for mouse interactions. Close #2208 Fix #2138 Fix #2196 Fix #2007 Fix #1517
* Improves React Native compatibility by making StyleSheet.create the identify function. * Improves React 18 support by inserting styles on eval. * Supports use with multiple windows (i.e., iframes) and shadow roots. * Supports nested LTR/RTL layouts. * Supports 3rd party compilers and extraction to static CSS. * Fixes static and dynamic short/longform deduplication. * Reduces browser support: Safari 10.1+, Chromium Edge, no IE, no legacy Android browsers. * Removes automatic vendor-prefixing of inline styles (for better perf). * Removes focus-visible polyfill as modern browsers no longer show focus rings for mouse interactions. Close necolas#2208 Fix necolas#2138 Fix necolas#2196 Fix necolas#2007 Fix necolas#1517
Is your feature request related to a problem? Please describe.
When using styles inside a shadow root, styles are not applied, because react-native-web attaches styles to the document root
Describe a solution you'd like
Automatically attach styles to the shadow root instead of the document root if one is present. Resolve issues of cascading rules where a shadow root breaks up parents from children.
Describe alternatives you've considered
Avoid having styles compiled into a stylesheet with classes altogether, and have all styles inlined on components.
Additional context
The primary context here is that my react app is rendered inside a custom element, which can be included on anyone else's page as a widget. In order to get style isolation, I must render my app inside a shadow root (natively, or using
react-shadow
). This gives me proper style isolation from the outer (uncontrolled) application, but it also causes me to lose all of my styles from react-native-web.The text was updated successfully, but these errors were encountered: