-
-
Notifications
You must be signed in to change notification settings - Fork 232
Tooltip Sometimes Randomly Closing Immediately on Trigger Hover #2758
-
🐛 Bug reportI'm developing a feature where hovering over a tab shows a tooltip that previews the contents of that tab. The content is an HTML video stream, and for development purposes, I'm rendering a scene using Babylon.js, a 3D engine. The bug is that sometimes, when I hover over the trigger, the tooltip opens and then immediately closes.
I tried to reproduce this bug in an isolated environment but was only able to do so when using the 3D engine. However, there are still differences between the reproduction and my development environment. For example:
I don't know if this is a Zag.js issue, or external library issue, and I don't know if there is more than one bug here. I'm honestly at my wits' end. My guess is that its potentially related to a race condition that happens when the tooltip contents are first mounted. 💥 Steps to reproduce
💻 Link to reproductionhttps://stackblitz.com/edit/d2lrbd4p?file=src%2FTooltip.tsx I've disabled all props responsible for closing the popover in the reproduction above. 🧐 Expected behaviorThe tooltip should not close immediately upon hover. 🧭 Possible SolutionMy current solution is to disable unmounting in the background. This fixes the bug for subsequent hovers, but sometimes the first hover still triggers the bug. My last resort is to use a fully controlled popover instead and handle the trigger hover state manually. 🌍 System information
|
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
This is indeed a complex scenario. Not sure how to help here.
There's a good chance that the canvas receives focus when it's mounted. That's what I'd look out for. You might get a decent improvement in my settings tabIndex={-1} on the canvas.
Technically, however, you should use a popover here, not a tooltip, as it contains more contextual information.
Beta Was this translation helpful? Give feedback.