Skip to content

Commit

Permalink
fix(rac): Improve the comment to explain Tooltip Button
Browse files Browse the repository at this point in the history
Change-Id: Ibca1d4342b4154a74538bd51661be832ca7e3934
GitOrigin-RevId: 2391ebf8cf9a10478acdc1f116fec730c6a894dc
  • Loading branch information
sarahsga authored and actions-user committed Oct 29, 2024
1 parent e329708 commit 22fa431
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plasmicpkgs/react-aria/src/registerTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const { variants, withObservedValues } =
React Aria's TooltipTrigger only allows Aria Button component to act as a trigger.
https://react-spectrum.adobe.com/react-aria/Tooltip.html#example
To bypass that limitation, we use useButton,
To bypass that limitation, we originally used the useTooltipTrigger custom hooks for advanced customization, so the trigger could become anything we want.
One of the limitations with that was the placement prop - the useTooltipTrigger did not provide placement prop, and that caused issues with tooltip positioning.
We have a better fix now - instead of using useTooltipTrigger, we use useButton,
so that anything we add to the slot can be treated as an Aria Button.
That means we can use the ready-made components provided by react-aria-components (like <TooltipTrigger> and <Tooltip>)
and still be able to use any other component as a trigger.
Expand Down

0 comments on commit 22fa431

Please sign in to comment.