Skip to content
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

Merged
merged 10 commits into from
Oct 13, 2021

Conversation

kangaechigai
Copy link
Contributor

@kangaechigai kangaechigai commented Sep 20, 2021

🚀 Enhancements

@kangaechigai kangaechigai marked this pull request as ready for review September 20, 2021 20:45

it("should pass zIndex prop from component to Portal", () => {
const wrapper = shallow(
<TooltipWithZIndex zIndexOption={1} zIndexProp="var(--tooltip-zindex)" />,

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

@williaster williaster left a 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
Copy link
Collaborator

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()", () => {
Copy link
Collaborator

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 😅 )

@kangaechigai
Copy link
Contributor Author

@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 TooltipWithBounds viewport detection & will try react testing library there.)

Copy link
Collaborator

@williaster williaster left a 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 👀

@williaster williaster merged commit 9297707 into airbnb:master Oct 13, 2021
@github-actions
Copy link

🎉 This PR is included in version v2.2.0 of the packages modified 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltips created by Tooltip in visx/xy-chart can appear behind the chart in some cases
3 participants