-
Hey! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
The RAC (react-aria-components) TooltipTrigger sends the focus/press props that the trigger needs via a context setup by FocusableProvider + . Our RAC Button's call ofuseButton accesses this context via a useFocusable call so if you were to use your own custom button element you'd have to call useButton as well. For non-button elements you'd call useFocusable and usePress .
I'd be careful when accepting any element as a trigger since you'll want to make sure its an element that supports focus/press interactions. Is there a particular reason you can't use our RAC Button for your usecase? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer! If I call We already have a button component implemented in our component library. We could for sure replace it with the RAC Button, but we still have lots of other focusable components that need the ability to be wrapped in a Tooltip. |
Beta Was this translation helpful? Give feedback.
-
Actually, the |
Beta Was this translation helpful? Give feedback.
The RAC (react-aria-components) TooltipTrigger sends the focus/press props that the trigger needs via a context setup by FocusableProvider +
react-spectrum/packages/@react-aria/focus/src/useFocusable.tsx
Line 55 in f65c181
useButton
accesses this context via a useFocusable call so if you were to use your own custom button element you'd have to calluseButton
as well. For non-button elements you'd calluseFocusable
andusePress
.I'd be careful when accepting any element as a trigger since you'll want to make sure its an element that supports focus/press interactions. Is there a particular reason you can…