Replies: 2 comments
-
This seems to be due to the changes made in this PR to fix this issue. In general, we wanted to prevent events that happen within Dialogs/other portalled overlays from affecting its ancestors due to event bubbling, hence the contains checks made in that PR. Unfortunately, this affects the useHover applied to the parent div in your example. useHover's onPointerLeave will receive a Alternatively, another bug that happens is if you set the tooltips to be always visible via isOpen and you try hovering the div entering from the top going through the tooltip (https://codesandbox.io/s/react-aria-usehover-bug-demonstration-forked-8y46kn?file=/src/App.tsx). Note that the div doesn't receive the hover styles since onPointerEnter for the div actually triggers upon hovering the tooltip due to event bubbling and once again the e.currentTarget (div) doesn't contain the e.target (tooltip) hence hover start doesn't fire for the div. Behaviorally, this makes sense since we wouldn't want the parent div to switch to its hovered state if the tooltip is positioned in such a way that it falls outside of the div positionally. This is pretty tricky, will have to think on how best to handle these two scenarios but still block events that happen in a overlay from affecting its parents. |
Beta Was this translation helpful? Give feedback.
-
It seems like the same issue is surfacing when using useHover on a trigger element of an Overlay. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using
Tooltip
from react-aria-components anduseHover
from react-ariaI'm facing a bug when the Tooltip is displayed, useHover doesn't detect leave hover.
I made a CodeSandbox that reproduces the bug here: Link to CodeSandbox
Here is a video recording I uploaded on Google Drive that demonstrates the bug: https://drive.google.com/file/d/1oPMJapOR35YWfRCb9fkYZywZYw5_A_u-/view?usp=sharing
Observe that:
How to fix this problem such that when Tooltip is open, leave hovering the element will be detected (that is the tooltip will be shown in white after user's mouse has left the div)?
Some more observations I found:
A little context on what I'm intending to achieve here, I'm using
useHover
to check if user is hovering over thediv
, and if user is, I want to show the menu button. The menu button will need to have a tooltip that describes that it is a 'Menu'. When user leave the div, I want to hide the menu button, the problem is after user hovers over the menu button and triggering the tooltip, then leaves the div, themenu
button will not disappear, because leave hover is not detected.Beta Was this translation helpful? Give feedback.
All reactions