-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 still applied to main DOM when using Shadow DOM. #7204
Comments
Without a doubt you've identified some strange behavior. Let me try to explain what was intentional and what wasn't... For normal DOM usage (not shadow DOM), styles should be attached to the document ASAP to avoid a FOUC. If we wait until a Calendar is initialized, it's too late. That's why we attach it globally as soon as the FullCalendar library executes. It's not possible to wait until a Calendar is initialized and then conditionally include the styles based on whether it's inside a shadow DOM or not. The reason the styling WITHIN a shadow DOM breaks when the document-level styles are removed is that the shadow DOM styles rely on outer At some point we'll stop using css variables, and we'll move away from font-face for icons. We'll reevaluate then. Is this causing you any bugs? |
We have a somewhat big microfrontend where fullcalendar might come from multiple projects and loaded into the same page, even different major versions. |
@arshaw Not exactly a bug, but there are all these CSS styles trampling all over every single element across the entire app in Chrome Dev Tools because they're not scoped to a full-calendar element. Developers are having a hard time finding our own CSS variables because of this. (It's driving us crazy that they aren't scoped to .fc or something similar. Is there any configuration or work-around we can set to change them to be scoped to .fc instead of :root? We can't even import a custom, modified CSS file, because FullCalendar injects the styles directly via JS.) |
@arshaw ....Is there any way to remove the CSS? Honestly, we'd much rather have a FOUC (On our side we can |
I have the same problem, in microfrontend |
My front end chops are lacking in the modern era, but after two days futzing with this I have to ask: is this related to #7720? |
Reduced Test Case
https://codepen.io/arshaw/pen/zYLJeRx?editors=0010
Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?
Which connector are you using (React/Angular/etc)?
No connector (vanilla JS)
Bug Description
Related to #7118
When using Shadow DOM, the styles are added to the Shadow DOM.
However, they are also still added as style elements to head of main page, which can be seen when inspecting the DOM.
Also, if the style elements then are removed from the main page manually, some parts of the styling, like the grid lines, go missing.
(The style element that starts with :root{... )
So seems to be things in the main DOM required even though the Shadow DOM seems to contain the same part.
Before removal
After removal
The text was updated successfully, but these errors were encountered: