fix(ui): Ensure tooltips render above dialog content#9093
Conversation
🦋 Changeset detectedLatest commit: b5cd937 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR fixes tooltip layering by adding floating-tree node awareness to the Tooltip component ( ChangesTooltip layering fix
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant TooltipRoot
participant useTooltip
participant FloatingTree
participant TooltipContent
TooltipRoot->>useTooltip: initialize with options
useTooltip->>FloatingTree: useFloatingNodeId()
FloatingTree-->>useTooltip: nodeId
useTooltip-->>TooltipRoot: context with nodeId
TooltipRoot->>TooltipContent: render with context
TooltipContent->>FloatingTree: wrap portal in FloatingNode id
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ui/src/elements/Tooltip.tsx (1)
77-105: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd
bubbles: falsetouseDismiss. With the nestedFloatingTreesetup, the defaultoutsidePressdismissal can bubble to the parent modal and close it too. The Escape-key case doesn’t rely on bubbling here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/elements/Tooltip.tsx` around lines 77 - 105, Add bails-out for nested tooltip dismissal by updating the useDismiss call in Tooltip to disable bubbling for outside-press handling. The issue is that the current dismiss behavior can propagate through the FloatingTree and close a parent modal when a tooltip is dismissed; update the useDismiss configuration in Tooltip.tsx so outside presses do not bubble. Keep the Escape-key behavior unchanged while ensuring the tooltip still closes correctly on outside interaction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/ui/src/elements/Tooltip.tsx`:
- Around line 77-105: Add bails-out for nested tooltip dismissal by updating the
useDismiss call in Tooltip to disable bubbling for outside-press handling. The
issue is that the current dismiss behavior can propagate through the
FloatingTree and close a parent modal when a tooltip is dismissed; update the
useDismiss configuration in Tooltip.tsx so outside presses do not bubble. Keep
the Escape-key behavior unchanged while ensuring the tooltip still closes
correctly on outside interaction.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Repository UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: a016d2e6-5655-4b8a-af45-6e7d69aae03c
📒 Files selected for processing (3)
.changeset/tooltip-above-modal.mdpackages/ui/src/elements/Tooltip.tsxpackages/ui/src/foundations/zIndices.ts
Description
Fix tooltips rendering behind modals (for example on the organization profile Security page). Tooltips now layer above modal content, and pressing Escape or clicking outside while a tooltip is open inside a modal closes only the tooltip instead of also dismissing the modal.
BEFORE
before.mov
AFTER
after.mov
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Escapeor outside click without closing the modal itself.