fix(toolbar): Fix tooltip & hovercard & menu react-portal rendering inside the toolbar #74797
+47
−20
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.
What you can barely see here is a css change in the before & after shots.
In the before there's no css applied. After there is some css (but z-index is too small, that's fixed in 37a40c6 in this PR)
What's happening?
We are importing a component that eventually calls, in the before case:
createPortal(..., document.body)
. The trouble with that is where the import happens. In the website codebase we import it and the whole react tree, including emotion css, is inside ofdocument
.But in this case we're importing it into toolbar code, so the react root starts inside our
ShadowRoot
reference instead ofdocument.body
. All our toolbar css is inside the shadowroot too, so when we use emotion and generate a className likesentry-devtools-b0afu4
nodes mounted atdocument
won't be able to access it.TL/DR: the portal target inside the toolbar needs to match with this snippet, using the same
container
value:sentry/static/app/components/devtoolbar/components/providers.tsx
Lines 23 to 34 in 6bb4638
Before
After