ui
ui copied to clipboard
fix(tooltip): Add missing `TooltipPrimitive.Portal`
Hey!
I encountered a bug when using a <Tooltip /> within a <Dialog />. According to the the Radix documentation, it seems TooltipPrimitive.Content should be wrapped by the TooltipPrimitive.Portal to work in all contexts. This solved my bug.
Best ✌️
@pierrelevaillant is attempting to deploy a commit to the shadcn-pro Team on Vercel.
A member of the Team first needs to authorize it.
Worked fantastically for me, would love to see this get merged ASAP @shadcn.
Thanks a ton @pierrelevaillant
Great find!
But I would have followed the example from the Popover:
- does not create a new const
- does not export the new const
- just use the <TooltipPrimitive.Portal>
https://github.com/shadcn-ui/ui/blob/0fae3fd93ae749aca708bdfbbbeddc5d576bfb2e/apps/www/registry/default/ui/popover.tsx#L16
So, in our case:
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content />
</TooltipPrimitive.Portal>
Great find!
But I would have followed the example from the Popover:
- does not create a new const
- does not export the new const
- just use the <TooltipPrimitive.Portal>
https://github.com/shadcn-ui/ui/blob/0fae3fd93ae749aca708bdfbbbeddc5d576bfb2e/apps/www/registry/default/ui/popover.tsx#L16
So, in our case:
<TooltipPrimitive.Portal> <TooltipPrimitive.Content /> </TooltipPrimitive.Portal>
You're right @borzaka, there is no need to export the Portal here. Thanks!
I'm a little bit doubtful that it should always be called as portal.
I'm wondering what you think about giving the user a choice, because I think what shadcn/ui does is theme the radix, so shouldn't we keep the radix interface the same? I think so.