-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[preact/compat] @radix-ui/react-tooltip immediately hide tooltip after hover on element #3805
Comments
hover 状態でも tooltip の表示が永続化されず、表示後即座に消えてしまう ([issue](preactjs/preact#3805))
hover 状態でも tooltip の表示が永続化されず、表示後即座に消えてしまう ([issue](preactjs/preact#3805))
hover 状態でも tooltip の表示が永続化されず、表示後即座に消えてしまう ([issue](preactjs/preact#3805))
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I found a solution. It does not "solve" the problem, but works anyway. https://codesandbox.io/s/preact-radix-ui-react-tooltip-issue-forked-kys9rl?file=/src/tooltipDemo.tsx Just import I found this technique in the code of shadcn/ui's Collapsible-demo. |
@nikogoli Very interesting find, I really wonder if it's some kind of double event firing/... but it stands out that if other libraries are running into it that it might not be isolated to preact 😅 |
I am actually quite unsure of how this even works in React, the steps are the following
This kind of relies on the Tooltip being rendered after the document finishes the processing of the event. As the DOM interleaves microticks between bubbling this isn't a set time so the node could have mounted or not yet 😅 in the core of Preact we handle this with an event-clock so an event that's newer than its listener won't fire a callback. These are custom events and maybe the React event delegation handles that similarly 😅 |
Describe the bug
Radix tooltips immediately closing after hover on element
To Reproduce
https://codesandbox.io/s/preact-radix-ui-react-tooltip-issue-lshsmd?file=/src/App.tsx
Steps to reproduce the behavior:
Expected behavior
Expected that tooltip will be visible all time when cursor is hover button
The text was updated successfully, but these errors were encountered: