-
Notifications
You must be signed in to change notification settings - Fork 715
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
Allow specifying zIndex for tooltip portals #1346
Allow specifying zIndex for tooltip portals #1346
Conversation
34abd9d
to
5ba6651
Compare
|
||
it("should pass zIndex prop from component to Portal", () => { | ||
const wrapper = shallow( | ||
<TooltipWithZIndex zIndexOption={1} zIndexProp="var(--tooltip-zindex)" />, |
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.
@kangaechigai , is the setting for zIndexOption
needed here since you're setting the zIndexProp
?
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.
Not needed, but I wanted to illustrate that the prop overrides the option.
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.
Hey @kangaechigai thanks so much for the contribution! Sorry for the slow review, I was gone on vacation for the past few weeks ⛱️
Looks like there may be a merge conflict but otherwise this looks great to me! If you don't have the bandwidth to fix the conflict let me know and I can take over. thanks again! ❤️
@@ -154,8 +156,8 @@ interface RectReadOnly { | |||
|
|||
`Portal` is a component which simply renders its children inside a `div` element appended to | |||
`document.body` created by `ReactDOM`. A `Portal` can be an effective strategy for solving the | |||
(`z-index` stacking context | |||
problem)[rg/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context] for | |||
[`z-index` stacking context |
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 this fix 🙏
return <TooltipInPortal zIndex={zIndexProp}>Hello</TooltipInPortal>; | ||
}; | ||
|
||
describe("useTooltipInPortal()", () => { |
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 adding tests!
you've already done the hard work with enzyme, but just noting that we recently added react testing library so that's also an option (no need to refactor unless you feel particularly inclined 😅 )
@williaster Thanks for the review (and for setting a good example of not reviewing while you were on vacation)! I resolved the merge conflict. I probably won't have bandwidth anytime soon to refactor tests, so hopefully the current enzyme ones are okay for now. (I might open another PR in the next couple weeks with some potential improvements to |
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.
amazing, thanks for the merge conflict/CI fixes 🙌 and no worries at all about enzyme vs RTL, sounds good re TooltipWithBounds I'll keep an eye out 👀
🎉 This PR is included in version |
🚀 Enhancements
@visx/tooltip
:Portal
acceptsstring
forzIndex
to allow for the use of CSS custom properties.useTooltipInPortal
accepts azIndex
option to pass through to thePortal
. TheTooltipInPortal
component it returns also accepts azIndex
prop to override the option.@visx/xychart
:Tooltip
accepts azIndex
prop to pass through to thePortal
. Fixes Tooltips created by Tooltip in visx/xy-chart can appear behind the chart in some cases #1333.