-
Notifications
You must be signed in to change notification settings - Fork 70
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
update so classes get correctly applied with Styled JSX #24
Comments
I'm gonna guess something in the styled-jsx/react stack is whitelisting native elements, which would make it incompatible with web components. We're not doing anything with class/classname in media-chrome that would cause this. The answer for a lot of react ecosystem things is probably react wrappers for each component, at least until they support custom elements more cleanly. |
Looks like there's an answer to this, just not quite merged in yet. |
@heff good find! that's exactly it 👌 |
If anyone else is running into this, please go thumbs-up the PR. |
@dylanjha is there anything else we can do here besides wait? If not let's close this issue. |
styled-jsx is a popular method for css-in-js in the React ecosystem.
The way it works is like this:
The
p
tag in this style only gets applied to this component. Internally, the library creates a unique class, and it applies that class to the HTML elements in the component AND the selectors in the CSS. So the DOM and CSS ends up looking like this:The css looks like:
When I attempted to do this with media-container I got the following:
media-container classname="jsx-1234"
should bemedia-container class="jsx-1234"
. It's almost as if styled-jsx things media-container is a react component and it's passing inclassName
down and it ends up being an attribute on the web component.There is a way to workaround this by using
.video-container :global(media-container)
, but ideally the above code should work.I don't know if the fix would be on the media-chrome side or the styled-jsx side to make this compatible. This issue might be relevant
The text was updated successfully, but these errors were encountered: