-
Notifications
You must be signed in to change notification settings - Fork 53
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
"Children" not replaced on mount when shadow DOM is disabled #41
Comments
@marvinhagemeister Do you have any ideas perhaps? |
Woa, it's the prettiest bug repro we've received in any Preact repositories by a long shot! Love the animation effect 👍 Sounds like
|
@mbohgard given our current org developments, what do you think of this issue now? |
@marvinhagemeister Hah, thanks for the design compliments. This was used internally for a demonstration for higher ups. Had to be somewhat pretty to sell the idea ;) @wbern Yes the second part of this issue(s) is solved. There is still the issue that remains when having shadow DOM disabled (issue title updated). Personally, we can work around this, but maybe it should be mentioned in the docs what limitations there are while having shadow DOM disabled if there is no solution coming. |
Hey! Do you mind to share a snippet of your workaround?
Serverside Rendered HTML:
The Result with those snippets is for me:
Preferred Solution:
If this is the atomic problem, please tell me i really would like to dig into this nice project! |
I have the same issue. @paull39 (and other) do you have found a solution? |
I found a solution, this package works well: https://github.com/jhukdev/preactement |
For me this still does not work. If you change |
If I were doing this for real, I'd make a separate web components bundle so there are no side effects in the npm package. Problem right now is being able to pass `children` to web components. Going to try https://github.com/jahilldev/component-elements/tree/main/packages/preactement#readme next based on [this issue thread](preactjs/preact-custom-element#41)
there is issue in this library, please check jahilldev/component-elements#26 it doesn't support nested custom-elements on DOM |
We have a design system with components written in React. I was thinking of rendering those with preact compat and then wrapping those in
preact-custom-element
to be able to use the components in a Vue/Angular or vanilla js app. I get a few issues tho.{children}
for<slot />
if I want to keep compatibility with React and also it didn't work when I tried it.Using a shadow DOM here, passing
shadow: true
to the register function ofpreact-custom-element
works but since I'm using Emotion as a CSS-in-JS I need the global styling support. There are ways of controlling where Emotion inserts styles and use shadow DOM here but that would probably mess with other teams implementation as of now. I would like it to be able to use this lib without enabling shadow DOM.2. I can't get property bindings to work at all as demonstrated in this PR. Attributes work fine, but properties doesn't end up as props on the Preact component (whether shadow DOM is used or not).All the issues is demonstrated in this sandbox.
The text was updated successfully, but these errors were encountered: