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
This manifests in real-world applications that use lazy loading of React components (and CSS modules for application styles in this case but I don't think that's necessarily relevant) and Fluent UI React v9 for controls. In this case application authors want to override default Fluent styles with their own CSS but because their components are lazily loaded and they cannot control where Griffel styles are loaded in the document they cannot be guaranteed their styles will have greater specificity than Fluent's built in Griffel styles.
With the default example, by inspecting the source, you can see how some application CSS is loaded in the document first, then Griffel styles, then more app CSS.
I'd like an API for Griffel that allows me to control where Griffel's style tags are inserted so I can ensure they are in the correct place relative to my application's styles.
The text was updated successfully, but these errors were encountered:
layershifter
changed the title
Allow authors to control Griffel style tag insertion location
core: allow to control Griffel style tag insertion location
Feb 10, 2023
layershifter
changed the title
core: allow to control Griffel style tag insertion location
core: allow to control style tag insertion location
Feb 10, 2023
We need to keep all style elements created by a Griffel in a group. To ensure that it's true we need to keep the existing approach with style buckets and being them siblings.
The more reasonable option for me is insertionPoint, going to create a PR with.
Internally Griffel ensures its style tags are inserted in the correct order to provide deterministic results. However, when used in an application that lazy loads code and styles, Griffel's style tags may become interleaved with the application's style tags, resulting in non-deterministic results.
This manifests in real-world applications that use lazy loading of React components (and CSS modules for application styles in this case but I don't think that's necessarily relevant) and Fluent UI React v9 for controls. In this case application authors want to override default Fluent styles with their own CSS but because their components are lazily loaded and they cannot control where Griffel styles are loaded in the document they cannot be guaranteed their styles will have greater specificity than Fluent's built in Griffel styles.
I've created a rough demo of this on Codesandbox: Griffel Lazy Load
With the default example, by inspecting the source, you can see how some application CSS is loaded in the document first, then Griffel styles, then more app CSS.
I'd like an API for Griffel that allows me to control where Griffel's style tags are inserted so I can ensure they are in the correct place relative to my application's styles.
The text was updated successfully, but these errors were encountered: