-
-
Notifications
You must be signed in to change notification settings - Fork 534
[BUG]: tooltip show again after closing the modal #1096
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
Comments
Please upgrade to the latest There was a bug similar to this, but I can't remember if it was fixed before or after 5.18.0. |
⛔ That's not solve my problem, i update the package for version |
it's just a guess, but the button might be getting focused when the menu is closed. By default, the tooltip opens on hover, and on focus. Try If that doesn't work, please provide a CodeSandbox (or similar) reproducing the issue so we can properly evaluate it. |
@gabrieljablonski thank you for your care |
The issue is in fact caused by the button getting automatically refocused when the menu closes. The reason we use the By reading this section on the If keyboard navigation is not a requirement for you, try using <Menu.Button
className="px-4 py-2 text-sm font-medium text-gray-700 w-full bg-red"
data-tooltip-id="my-tooltip"
data-tooltip-content="Hello world!"
onFocus={(e) => {
// immediately blurs after focus
e.target.blur();
}}
>
test
</Menu.Button> If this is a not an acceptable solution for your project, let us know and we'll try to think of another alternative. |
that's amazing solution, and it's worked perfectly so it's not best-practise and good-solution to add in other side of project we're not using so the best-practise for our project is that the package handle all those things, and it's give us a very clean-code . |
That's understandable. As you can see on this other issue here, we're already planning on making it possible to select which DOM events the tooltip should listen to, but it will probably take a while until we get to that. My suggestion is to either use I'm sorry that we can't help more directly, but unfortunately it will probably take some time until we work on it. Hopefully one of this alternatives works for your project. |
As noted above, this is a poor interaction between the tooltip opening on focus, and the |
I experience similar bug, but when navigating between pages. When page is mounted, tooltip appears automatically. I checked events: hover and focus events were not fired. tabIndex didn't help me. |
@zvs001 are you able to provide a reproducible example? Try using <Tooltip
openEvents={{ mouseenter: true, focus: false }}
closeEvents={{ mouseleave: true, blur: false }}
/> |
Hello, just to add a little feedback. I had the same issue as OP, but I'm using react-bootstrap component lib. It happened very similarly as reported here, but after closing a Modal or Offcanvas component from react-bootstrap. It seems to me the cause was also the refocusing of the button by react-bootstrap, since disabling focus on openEvents prop solved the issue. [email protected] Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Bug description
I have an issue while using the
react-tooltip
package, here is the description:I have a button, and when I click it, it opens a modal. After closing the modal by clicking outside of it, the modal is closed, but the problem is that the tooltip appears again, and it is not hidden until we click somewhere else in the body.
Screenshots
here is an example:
1.
case-1.mp4
so i try to find the problem, by using
afterHide
andafterShow
prop and here's the log in console:case-2.mp4
so here's my code :
Version of Package
v^5.18.0
To Reproduce
Steps to reproduce the behavior.
1- click the button, it open the modal
2- close the modal
3- tooltip is appear immediately
Expected behavior
i expect when i close the modal, i don't want to show the tooltip message again
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information if possible or delete this section):
Additional context
<a></a>
anchor tag and it seems no problem with it, but i requred to use<button></button>
tag, because of the code-base.state
but i work on large project, with hug code-base and it's amazing if i use those attributes:data-tooltip-id="my-tooltip"
data-tooltip-content="Hello world!"
is there anyway to fix this problem ?
is that a bug, or the problem in implementation ?
The text was updated successfully, but these errors were encountered: