-
-
Notifications
You must be signed in to change notification settings - Fork 528
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] Tooltip position and show status not synchronized. #1010
Comments
This one will be a lot trickier to solve. The root of this problem is that the tooltip content and the tooltip position are updated independently. Since the position calculation may take more than 1 render cycle to finish, and updating the content will pretty much always take exactly 1 cycle, sometimes you'll see the text updating before the position. We've tried to fix this by updating the content and the position on the same cycle 100% of the time, but it turned out to be not that easy. The tooltip closing when you move from one element to another is actually a bug, since the expected behavior when using Here are some alternatives until we can tackle this on (it might take several days until we have the time):
If you have any other ideas, please let us know. |
Ah okay. I was going to ask about this earlier. Solving that bug might be a good next step.
This worked for me. However I noticed another issue that is kind of the opposite of the previous one: When hovering over an anchor, the tooltip's To resolve that I simply added the Ideally all of the state change (show/position/content) should update synchronously. I don't have any concrete suggestions for you at the moment, though, as I'm not that familiar with the code base. |
This issue is stale because it has not seen activity in 30 days. Remove the |
I'm experiencing a similar issue. reactTooltipBug.mp4Looks like the position is not updated before the tooltip is shown |
Also experiencing this on the latest version, even with the |
I've been digging, but I can't seem to find the problem yet. |
@dbidwell94 the original issue has to do with transitioning between two adjancent anchor elements, yours seems to be a little different. I am unable to reproduce it. If you could provide a sample repo it would help a lot. @knubie are you experiencing the same thing? as in:
Again, I haven't been able to reproduce this. |
Just recorded a demo video from my production app. I noticed the following things:
Here are the settings for my tooltip:
tooltip_bug4.mp4 |
@gabrieljablonski Here are the items in question: React tooltip instance => https://github.com/Tekxchange/web_ui/blob/master/src/App.tsx#L26 Go to current location data-id => https://github.com/Tekxchange/web_ui/blob/master/src/pages/app/map/index.tsx#L86 I'm not sure it's too big of a deal. While testing I have noticed it: A) only seems to happen on Opera (might happen on Safari as well, I'm not sure) |
@dbidwell94 thanks for taking the time. We'll investigate and see what we can do. |
@dbidwell94 please try the following setup: <ReactTooltip
id="tooltip"
delayShow={1000}
positionStrategy="fixed"
style={{ zIndex: 1000 }}
/> Setting :root {
--rt-opacity: 1;
} (As a side-note, we should probably add a more straight-forward way of setting the opacity, such as an I've also set @knubie Please confirm if you're setting |
:root {
--rt-opacity: 1;
} Just as a heads up, I believe a recent update in the way we inject the tooltip styling into the app broke setting the opacity like this. We'll be looking into this soon. Closing #1051 should help with this. |
Looks like this does indeed solve my problem. Thanks for getting back to me so quick! |
I can confirm that I'm not setting |
Okay 😓 So i figured out the issue. It turns out that the bar under the numbers also has a tooltip, and so when I was moving the cursor out of the first tooltip anchor, i was briefly hovering over the bar, which caused it's tooltip to be displayed. So I think everything is working as intended. I will close this issue now. |
I'll reopen this since the original issue isn't actually fixed. For future reference, the behavior in the first video in this issue is indeed a bug: https://user-images.githubusercontent.com/431251/230918927-995f1ccf-2449-40d8-8a4b-948c48605393.mp4 If anyone is experiencing this, refer to my earlier comment, which suggests using If the behavior is only similar, or you're not sure, please open a new issue so it's easier to track. We'll evaluate if it should be closed as a duplicate of this. |
I can reproduce the issue, but only in Firefox & Safari on a Macbook. It seems like not even |
@Uni2K what happens when using a slightly higher |
Okay, so we tested a lot and found out the following things:
This code was used to reproduce the issue:
See here, this is a video. We are not able to reproduce it in 100%, but maybe 80%. The tooltip is glitching during anchor change. The direction in which it is glitching corresponds to the position of the last opened tooltip. delayshow.300.movSee the second time the upper anchor is hovered -> the tooltip glitches from bottom to top. Also we found out that hovering from the bottom direction is causing it the most times. I hope this helps :s |
Thanks for taking the time. Another interesting thing to notice is how the opacity does not seem to transition properly (fade in on open) sometimes. I believe this is directly related. We'll investigate further. |
@Uni2K I've tried many different ways but I'm unable to reproduce this. Are you able to provide a sample project? |
@gabrieljablonski This glitch was only happening on Safari & Firefox on a Macbook. Never on Chrome, never on windows. I am in vacation and don't have a Macbook here, so I cannot create a sample project which reproduces the bug. The fastest time I could provide you a complete sample project is on 20.07. At least I can tell you that we just used a standart next.js template. The code above was just used as direct "return" of a page route. We tried a lot before we could find a somewhat reproduceable situation. Even with that, the glitch only happens in about 80% of the time. So, there has to be a random factor that to it. |
@Uni2K I do have a Macbook, please create a reproducible example and I'll try to test and debug it from my side, I'll share my findings with @gabrieljablonski and we will try to fix it if possible. |
Here is the repo: https://codesandbox.io/s/amazing-sanne-lnwmfg My coworker tested it with his Macbook. He could not reproduce the issue in Firefox, but he could reproduce it in Safari 16.3 on every 5-7 attempt. For now, this is the best I can provide. |
I tried a lot of times but the issue only happened 1 time with me, this will be hard to debug and fix. I'll take a look if we can reset the Tooltip coordinates when we close it, or something like that. |
@danielbarion we could try, but I'm guessing it won't work. my bet is on some weird CSS specification that safari doesn't follow exactly as it should. maybe something to so with how opacity transition is behaving |
Maybe I can help with a new video, checkout the clicking: delayshow-bug.mov |
I was having this issue (or at least a very similar one, mine was always only flickering in the top left of the page), and this was the hacky solution I came up with to get at least something working using the const [classNameSuffix, setClassNameSuffix] = useState('hidden');
return <Tooltip
id={uid}
className={`tooltip ${classNameSuffix}`}
delayHide={50}
delayShow={400}
clickable
afterShow={() => setTimeout(() => setClassNameSuffix('visible'), 50)}
afterHide={() => setClassNameSuffix('hidden')}
>
{....}
</Tooltip> and then my scss is just: .tooltip {
&.hidden{
visibility: hidden;
}
&.visible{
visibility: visible;
}
} |
Describe the bug
When moving from one anchor to another, sometimes the tooltip's position is updated before its visibility. This results in some glitchy / flickering behavior.
Version of Package
v5.10.6
To Reproduce
Tooltip
delayShow
to300
Tooltip
delayHide
to0
Expected behavior
The tooltip should hide first, then update position and content.
Screenshots
https://user-images.githubusercontent.com/431251/230918927-995f1ccf-2449-40d8-8a4b-948c48605393.mp4
Desktop (please complete the following information if possible or delete this section):
create-react-app
Additional context
Repro: https://github.com/knubie/react-tooltip-demo
Somewhat, but not really related: #1008
The text was updated successfully, but these errors were encountered: