You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a custom element and place a perspective-viewer in the shadow root. Stackblitz example.
Notice that the perspective-viewer-datagrid and regular-table instances created in the shadow root have incorrect styling
Compare inside shadow root:
vs not in a custom element shadow root Stackblitz example (note: style seems to load inconsistently, not sure why, might need to refresh a couple times):
It looks like the module import has a side-effect of globally inserting a stylesheet. Due to the behavior of shadow roots, those styles don't apply to the perspective element.
Expected Result:
I'd expect to be able to use perspective from within a shadow root, it does seem like most things would work, would just need a way to opt-in to the styling so I can apply it in my shadow root.
Would prefer if a global style was not inserted in the page. Or if the style just defined custom properties on :root {} that apply to the perspective shadow dom as custom properties can propagate through shadow roots. It would be helpful if those custom properties were prefixed in that case (--perspective-*) to prevent collisions. Even better if the prefix could be customized.
Actual Result:
Styles are inserted globally and fail to style perspective in a shadow root, see above.
Environment:
Windows, Chrome, Stackblitz (see links above), perspective 1.7.1
Additional Context:
This is a minimally reproducing example. My application is experimenting with using perspective with the FAST web components: https://explore.fast.design/components/
The text was updated successfully, but these errors were encountered:
<perspective-viewer> works fine in the Shadow DOM. The linked example has two issues:
The <link> tag which loads the theme is embedded in the Shadow DOM as well, and thus not read by the document until the custom element is connected, well after perspective-viewer.js is loaded, causing theme auto-detection to fail. You need to manually tell <perspective-viewer> what theme CSS is available (from the docs) by calling (in your case):
viewer.resetThemes(["Material Light"])
Perspective's themes have Google fonts, which won't be fetched when the CSS file is in the Shadow DOM. You'll need to separately download the necessary fonts in your document's <head>:
Looking at the example, I think that the perspective-viewer-datagrid global injected styles for the regular-table are still having issues applying in the shadow root of my custom element example:
Can see the missing row line styles and sort button styling. Is there something else I may have missed?
Bug Report
Steps to Reproduce:
Compare inside shadow root:
vs not in a custom element shadow root Stackblitz example (note: style seems to load inconsistently, not sure why, might need to refresh a couple times):
It looks like the module import has a side-effect of globally inserting a stylesheet. Due to the behavior of shadow roots, those styles don't apply to the perspective element.
Expected Result:
style
was not inserted in the page. Or if the style just defined custom properties on:root {}
that apply to the perspective shadow dom as custom properties can propagate through shadow roots. It would be helpful if those custom properties were prefixed in that case (--perspective-*
) to prevent collisions. Even better if the prefix could be customized.Actual Result:
Styles are inserted globally and fail to style perspective in a shadow root, see above.
Environment:
Windows, Chrome, Stackblitz (see links above), perspective 1.7.1
Additional Context:
This is a minimally reproducing example. My application is experimenting with using perspective with the FAST web components: https://explore.fast.design/components/
The text was updated successfully, but these errors were encountered: