Repository navigation
Components: Modal: Wrap the modal contents in a StyleProvider - #36261
Merged
Merged
Conversation
youknowriad
reviewed
Nov 5, 2021
| > | ||
| { title } | ||
| </h1> | ||
| <StyleProvider document={ document }> |
Contributor
There was a problem hiding this comment.
I'd love confirmation from @ciampo or @sarayourfriend I think the fix is correct but would love another opinion.
Contributor
There was a problem hiding this comment.
Yup, I think this is correct. Previously we had an internal Portal component that implemented something like this in the early days of trying to migrate the G2 style system.
I think we just forgot this edge case when adding the StyleProvider back to the app.
|
Size Change: +17 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
youknowriad
approved these changes
Nov 5, 2021
This ensures that any content inside a modal has the correct styles applied by emotion. Fixes #33735.
ryelle
force-pushed
the
fix/emotion-modal-styles
branch
from
November 5, 2021 21:12
a2dfa1a to
944cf66
Compare
andrewserong
pushed a commit
that referenced
this pull request
Nov 7, 2021
This ensures that any content inside a modal has the correct styles applied by emotion. Fixes #33735.
Contributor
|
Cherry-picked into the GB 11.9 release in 43a1769 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This ensures that any content inside a modal has the correct styles applied by emotion. Previously, any components using emotion styles in the modal content were not rendered correctly. The components are given a unique prefix ID (cache key), but no styles were registered to that UUID key. @youknowriad suggested that the Modal's portal needs
StyleProvider. I've added that, and now the emotion styles are being generated for modal content.Fixes #33735.
How has this been tested?
Manually tested using my test case plugin, the styles inside the modal were missing before the patch, but are loaded correctly now.
Screenshots
The issue was in the Site Editor (or any other iframed editor), so I added my test plugin into the Site Editor. It adds a button to open a modal with some components that use emotion styles.
Before, no grid and an invisible spinner.

After, grid layout with a spinner

Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).