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

Nested elements with tooltip #1193

Closed
XDSeverussnape opened this issue Jun 6, 2024 · 6 comments · Fixed by #1194
Closed

Nested elements with tooltip #1193

XDSeverussnape opened this issue Jun 6, 2024 · 6 comments · Fixed by #1194
Labels

Comments

@XDSeverussnape
Copy link

XDSeverussnape commented Jun 6, 2024

Hi!

I have nested elements with tooltips

but when I move cursor from child DOM element to parent, tooltip data doesn't change

this is how it looks: https://prnt.sc/10h83bt

reproducible demo: https://codesandbox.io/p/sandbox/react-tooltip-issue-y867xh?file=%2Fsrc%2FApp.js%3A6%2C32

is there a way to solve this?

@gabrieljablonski
Copy link
Member

gabrieljablonski commented Jun 6, 2024

#1194 switches over the default events watched on the anchor to mouseover and mouseout, which works best with nested anchor elements.

You can try it out with react-tooltip@5.26.4-beta.1194.rc.1 until we get an official release out. Here's your example updated to the new version (also slightly adjusted).

Let us know if that fixes the problem for you. This issue will be closed once the PR gets merged, so please leave it open for now if it does fix it.

@XDSeverussnape
Copy link
Author

XDSeverussnape commented Jun 6, 2024

I cant open: example updated.
And i don't understand how i can change mouseenter and mouseleave to mouseover and mouseout?

@gabrieljablonski
Copy link
Member

@XDSeverussnape sorry for the delay.

You should be able to open the updated example now, CodeSandbox used to create the sandboxes as public by default, I think they changed that and I didn't notice😅

And i don't understand how i can change mouseenter and mouseleave to mouseover and mouseout?

You don't need to change anything. This beta version (and the future release) switches over the default events from the previous mouseenter/mouseleave to mouseover/mouseout.

The tooltip component has the openEvents and closeEvents props you can use to select which events you want to use, but for your use case, you can leave them with the default values.

@XDSeverussnape
Copy link
Author

This solution works for me. Thank you very much for your help and quick response. We managed to solve an important issue in my project in a very short time. Thank you.

@gabrieljablonski
Copy link
Member

Great to hear! You'll get a notification once we close this and publish an official release so you can upgrade, but the beta version should work fine until then, so don't worry about it.

@gabrieljablonski
Copy link
Member

Fixed with react-tooltip@5.27.0

https://github.com/ReactTooltip/react-tooltip/releases/tag/v5.27.0

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

Successfully merging a pull request may close this issue.

2 participants