-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
[BUG] 66.68~83.35ms delay when delayShow and delayHide are set to 0 #1008
Comments
Try out the beta version for #1009
Although it might be theoretically possible (maybe doing some clever stuff with |
Awesome! Much better in both my test repo and actual project. Thanks for the quick turn around @gabrieljablonski. The additional 1-2 frame delay was not noticeable to my naked eye until I recorded it and went frame by frame, so I don't know if it's worth looking into or not unless you are looking for a challenge. 🙂 |
Good to know, we'll leave this open until we do an official release with the fix. Thanks for reporting.
Not right now haha, maybe in the future. If you ever run into any UI libraries that are able to do stuff like this with consistent 0-frame delay, let me know so I can have a look, but I doubt it's an easy thing to achieve. |
Fixed on official release |
So I might have spoken too soon. It seems like that extra 1 frame delay is actually causing some issues. Take a look at this recording: tooltip_1_frame_delay.mp4What's happening is that the position of the tooltip is getting updated immediately, but the hiding of the tooltip is delayed by a frame. I would like to dig into this more, but I'm having trouble working on the package locally. I tried using I'd like to try and figure out why the position is getting updated before the visibility. |
From my experience, this seems like an entirely different problem. I believe I've seen this exact behavior a few months ago, but I am unable to intentionally reproduce it with the more recent versions. For now I'll keep this issue closed since I'm pretty sure it's not related, and the problem with the debounce function is definitely fixed. If you can provide another sample project with this happening, I can take a look, and we can maybe open another issue to track this. |
@knubie you can try the package locally with this doc: https://github.com/ReactTooltip/react-tooltip/blob/master/CONTRIBUTION.md Also you can try Yalc simulates a local package registry, so, you just need to install Yalc globally with NPM or yarn, after this:
PS: normally I always run |
Cool, thanks @danielbarion I will try that. For now, here's the new issue: #1010 |
Describe the bug
When the
delayShow
anddelayHide
props are set to0
, there is still a 66.68~83.35ms delay. At least 50ms of delay can be attributed to the debounce function wraping thehandleShowTooltip
andhandleHideTooltip
methods here:react-tooltip/src/components/Tooltip/Tooltip.tsx
Lines 168 to 171 in 01c4a6f
Removing the call to
debounce
drops the delay to 16.67~33.34ms. The problem is that debounce is calling the functions on the trailing edge of the delay as opposed to the leading edge. The function also accepts animmediate
argument, but with the the way thatdebounce
is implemented here, passingtrue
forimmediate
just disables the function call entirely.react-tooltip/src/utils/debounce.ts
Lines 14 to 16 in 01c4a6f
I recommend taking a look at underscore.js for how to implement
debounce
with theimmediate
param.https://underscorejs.org/docs/modules/debounce.html
Version of Package
v5.10.5
To Reproduce
0
fordelayShow
anddelayHide
.Expected behavior
The hiding and showing of the tooltip should track with the hover state of the anchor.
Screenshots
With
debounce
:tooltip_delay2.mp4
tooltip_delay_list.mp4
Without
debounce
:tooltip_no_delay.mp4
tooltip_no_delay_list.mp4
The text was updated successfully, but these errors were encountered: