fix(v4 tooltip): tooltip arrow overlap issue #6934
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
This PR addresses the issue described in #6933 where the tooltip arrow can overlap with and appear above the tooltip content, potentially obscuring parts of the text or other tooltip content. Applies to the latest
<Tooltip>
component based on Tailwind v4 and React 19 with thenew-york
style.Problem
The tooltip arrow is implemented as a rotated square with styling that positions it in a way that can cause it to overlap with the tooltip content. Additionally, the z-index configuration allows the arrow to appear above the content, which can hide parts of the text when they overlap.
Solution
This PR simplifies the arrow implementation by:
See this CodeSandbox for a demo of the problem and the proposed solution: https://codesandbox.io/p/devbox/shadcn-tooltip-arrow-issue-8xdqwl
Changes
TooltipContent
component to use a more appropriatesideOffset
value to compensate for the removed styles (achieving the same rendered UI)Screenshots
Related
Fixes #6933