Skip to content

Radix Tooltip positioned incorrectly #2208

Answered by benoitgrelard
Miloshinjo asked this question in Help
Discussion options

You must be logged in to vote

Notice that if you remove around children of the tooltip component, tooltip doesn't even show. But if we have span, it shows around the parent element, not around the child (the circle) where it needs to be :)

That's because your InfoCircle isn't forwarding props/ref. If you're passing it as the child of the trigger (which you've use asChild on) you want to make sure that component accepts props/ref and is an interactive element (like a button or a).

Here, I've just removed the span around children and fixed the implementation of InfoCircle:
https://codesandbox.io/s/confident-bose-qr6psm?file=/src/App.tsx

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Miloshinjo
Comment options

Comment options

You must be logged in to vote
2 replies
@benoitgrelard
Comment options

Answer selected by benoitgrelard
@Miloshinjo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants