ui icon indicating copy to clipboard operation
ui copied to clipboard

fix(tooltip): Add missing `TooltipPrimitive.Portal`

Open pierrelevaillant opened this issue 1 year ago • 2 comments

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 avatar Jan 08 '24 11:01 pierrelevaillant

@pierrelevaillant is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 08 '24 11:01 vercel[bot]

Worked fantastically for me, would love to see this get merged ASAP @shadcn.

Thanks a ton @pierrelevaillant

zknicker avatar Jan 13 '24 07:01 zknicker

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>

borzaka avatar Feb 14 '24 09:02 borzaka

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!

pierrelevaillant avatar Feb 14 '24 10:02 pierrelevaillant

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.

minsoo-web avatar Jul 20 '24 09:07 minsoo-web