Open kruzliak-juraj opened 3 months ago
We use FocusableProvider to implement both the RAC and RSP tooltip components https://codesandbox.io/p/sandbox/vigilant-haze-njn7t8?file=%2Fsrc%2FApp.js%3A12%2C27 I'm not sure why we aren't exporting that in the mono package, I'll bring it up in the team given that we use it for both of our implementations
Feel free to check out our component implementations https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/Tooltip.tsx they are all based on our hooks. It may be easier to use the RAC component instead of building your own, it can be hard to wire up all the hooks correctly. https://react-spectrum.adobe.com/react-aria/Tooltip.html#tooltip
Provide a general summary of the issue here
When using the
useTooltipTrigger
as described in documentation -let { triggerProps, tooltipProps } = useTooltipTrigger(props, state, ref);
- the
triggerProps
haveonPointerEnter
prop that is supposed to be used on the element that should reveal the tooltip.This works fine when used on a regular
<button>
element, but when used withuseButton
on my ownButton
component, it will fail to open the tooltip. TheuseButton
does not return theonPointerEnter
within itsbuttonProps
, it gets ignored and removed.๐ค Expected Behavior?
I am able to see two possible behaviors that I would like to see
buttonProps
fromuseButton
should also include any other valid event callbacks that are passed to theuseButton
useTooltipTrigger
should returnonHover
and similar properties that are accepted byuseHover
so I can useuseHover
internally within myButton
component - (not favorite for many reasons)Maybe there is a better solution I do not see. Currently, My current solution is to just take
{ onPointerEnter } = props
out and apply it directly๐ฏ Current Behavior
Tooltip build with
useTooltipTrigger
does not work when triggered by Button build withuseButton
๐ Possible Solution
No response
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
https://codesandbox.io/p/sandbox/infallible-banach-s5pcyx
Version
"react-aria": "3.33.1"
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Windows
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response