-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
feat(Tooltip): implement afterShow
and afterHide
callbacks
#899
Conversation
Hey, thanks for the contribution. Since we're already here, would you mind doing |
@gabrieljablonski done 😄 |
Thanks. At first glance everything looks good. I'll test it out and review the PR later today. |
afterShow
and afterHide
callbacks
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.
There's a slight issue that should probably be solved.
-
When using
afterHide
on a tooltip withevents={['click']}
, clicking anywhere outside the anchor element will trigger ahandleShow(false)
call, which in turn triggers theafterHide()
call, which I believe is not desirable. -
Similarly, when using
afterHide
on a tooltip withdelayShow
, hovering away from the tooltip before it is shown will trigger a call toafterHide()
.
There should be a check if the tooltip was actually being shown before calling afterHide()
. The same for afterShow()
should probably also be done, although I don't believe it will make a difference in practice.
By using useEffect, it seems to work nicely, tell me if I have understood correctly the bugs and if it is fixed.
Screen.Recording.2023-01-12.at.08.42.39.mov
Screen.Recording.2023-01-12.at.08.46.03.mov |
This fixed the problems I mentioned, but it still left the issue of the There were a few other ways to fix this, but I ended up adding a |
Everything should be good to go. As soon as @danielbarion reviews this, I'll merge it and do the v5.5.0 release. |
The code looks good to me. Thanks for the implementation @Oupsla! Thanks, @gabrieljablonski, and feel free to merge when you want. |
fix: #898