Skip to content

Commit c712104

Browse files
Fix tooltip alignment by defaulting mount to body (#14228)
## Summary - The repost / favorite / share tooltips on the giant track tile (and elsewhere) appeared to the right of their target icons, offset by ~240px. - Root cause: `WebPlayer.module.css` puts `transform: translateX(var(--nav-shift))` on `.mainContentWrapper` for the sidebar shift animation. CSS `transform` creates a containing block for `position: fixed` descendants, so any tooltip portaled inside that wrapper has its viewport-relative coordinates interpreted relative to the wrapper instead of the viewport. - Tooltip already routed `mount='page'` to `document.body` for this exact reason, but the default `mount='parent'` still portaled into the trigger's parent — inside the transformed wrapper. - Fix: change the default `mount` to `'body'`. Every Tooltip that didn't explicitly opt out is now aligned correctly. The opt-in `parentMount` on `TokenHoverTooltip` continues to work. ## Test plan - [x] Hovered Share on the giant track tile in a headless browser; tooltip center matched button center exactly (`offset = 0.0px`) and screenshot showed it centered above the icon. - [x] Spot-check Repost/Favorite/Share on a track page while signed in. - [ ] Spot-check other Tooltip call sites (play bar, table headers, rewards page) for any regressions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent f2ec198 commit c712104

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/harmony/src/components/tooltip/Tooltip.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ export const Tooltip = ({
135135
className = '',
136136
color = 'secondary',
137137
disabled = false,
138-
mount = 'parent',
138+
// `position: fixed` coordinates are skewed inside any transformed ancestor
139+
// (e.g. the sidebar-shift `transform: translateX` on the main app wrapper),
140+
// so default to portaling outside the React tree rather than into the
141+
// trigger's parent.
142+
mount = 'body',
139143
getPopupContainer,
140144
mouseEnterDelay = 0.5,
141145
mouseLeaveDelay = 0,

0 commit comments

Comments
 (0)