-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[regression] Handle deprecated KibanaThemeProvider uses to include KibanaRenderContextProvider #163103
Conversation
- this removes the need for a manual CurrentEuiBreakpointProvider and fixes issues with plugins' Emotions styles going to the wrong cache
- not sure about the copy on this 🤷
Pinging @elastic/eui-team (EUI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated snapshots look fine
LGTM
I think we can combine these changes with some of mine from #163137. I think I prefer to detect and handle it internally as you do here... it certainly makes it easier than making the Let's chat tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping with this, @cee-chen !
Thanks for fixing CI for me!! 😁 |
KibanaThemeProvider
s missing a parent KibanaEuiProvider
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
History
To update your PR or re-run it, just comment with: |
…163387) - Closes #163332 ## Summary This PR fixes dark mode issues which surfaced after #161914 and #163103 --------- Co-authored-by: kibanamachine <[email protected]>
Summary
Unfortunately, #161914 regressed #162365 in that many plugins and their Emotion styles (including EUI emotion styles) are now missing a cache and are being appended to to the end of the document
<head>
as opposed to within<meta name="emotion">
.What appears to be happening is many plugins are using a parent
<KibanaThemeProvider>
but not a parent<KibanaRootContextProvider>
(not sure if this work is TBD or in progress). This means that a parent<EuiProvider>
, (which determines the cache insertion of child Emotion styled components) is missing, which is causing several CSS specificity bugs, e.g. around datagrid.As a somewhat-bandaid-y fix, I've bogarted EUI's nested provider context to check if the theme provider has a parent
EuiProvider
, and if it doesn't, to useKibanaEuiProvider
instead ofKibanaThemeProvider
. This should set up the caches and context if needed, or otherwise simply use the originalKibanaThemeProvider
component.FYI
If you see an error like this, in console dev tools, that means an Emotion cache somewhere is improperly set up. All of EUI's and Kibana's default caches should have
.compat = true
set, which silences these errors.QA
Previous/broken behavior
<head>
<meta name="emotion">
, you'll only see a couple hundred style nodes:<head>
, you should see a lot of<style data-emotion="css">
nodes:Fixed behavior in this PR
<head>
<meta name="emotion">
, you should now see well over thousands of styles<style data-emotion="css">
with EUI styles at the end of the head (there's a lot of<script>
tags instead). There's still a few, but they appear to not be EUI styles (e.g. it's a plugin's random Emotion styles that they're using without a cache set up).