-
Notifications
You must be signed in to change notification settings - Fork 15
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
add option to disable / opt-out of Shadow DOM to support global CSS libraries #60
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Just commenting to keep this alive a bit longer. 🤞 |
Sorry for the delay on this, looking at your point you are right the route element should append it all in the light dom, I'll change this. Thanks for raising it. |
Analyzing this a bit further I see a complication with a use where you provide the route content through the I think the only way to fulfill this feature without loosing other will be with an option in the |
Yeah, I think it would make sense to make this an opt-in feature, which by default I think should work as it does now, to render into Shadow DOM, and continue to follow natural behavior of WCs and their compositional properties, like with For users like myself who have a need to break out of that model (and also maybe with a link to a resource that explains what you lose when turning off Shadow DOM) would be a good way to get the best of both, and would be a backwards compatible change. 💯 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Feature Request
Problem to solve
As great as Shadow DOM in Web Components is, for projects supporting and / or trying to migrate away from global CSS, they may need to keep global CSS in lieu of encapsulating all styles.
How this relates to this project is that the custom element provided by this library has it enabled, which means for all apps using this library but also trying to use libraries like Bootstrap or Font Awesome (like me 😅 ), this library will block out all those global styles within the route. (which is the expected behavior, naturally).
(screenshots and more details at the end 👇 )
Possible implementation
Lit provides a way to disable this from the
LitElement
base class by usingcreateRenderRoot
Thinking of this from a user of this library's perspective, I think it would look something like this
Not specifically sure how that would be implemented within this project though on the fly though?
(Lit doesn't specify what the default would be, I am assuming it is
this.shadowRoot
, but i can certainly ask on their issue tracker if it helps)Alternatives considered
Technically there is one way to work around this, which is to just literally inline / include all that global CSS into the Shadow DOM for each custom element. Unfortunately, this means you'll basically be duplicating all that CSS over and over, which is terrible for bundle size and user experience.
Additional context
You can check out my work in progress in this PR trying to to make all the CSS global, with the following observations:
<LitRoute>
is acting as a Shadow "boundary" preventing FA and Bootstrap from getting through to all the child components.The text was updated successfully, but these errors were encountered: