useTooltipTrigger and useButton #4206
-
I'm trying to make a tooltip component which can take anything as a trigger. It works like intended with everything except the button component with useButton hook implemented. You can focus it with tab but hover interaction don't work and when pressing it throws a warning in console about Spreading just Second way to fix that was with wrapping Button with FocusableProvider rom So my question is: You can take a look here, this version is spreading |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Your example has spread the tooltip trigger props and the same ref onto two different components. This will cause issues. For instance, the ref will be overwritten to be whichever component mounted last, in this case, the HTML button instead of the Button component. Start by making the two different and see if that resolves your issues. you should have something more like this, where 1 and 2 are the results of two different hook calls
As for "take anything as a trigger", be a little careful here, make sure that it can only be focusable elements. |
Beta Was this translation helpful? Give feedback.
Your example has spread the tooltip trigger props and the same ref onto two different components. This will cause issues. For instance, the ref will be overwritten to be whichever component mounted last, in this case, the HTML button instead of the Button component. Start by making the two different and see if that resolves your issues.
you should have something more like this, where 1 and 2 are the results of two different hook calls