[tooltip] Close when active trigger unmounts#4886
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,521.77 ms 🔺+308.78 ms(+25.5%) | Renders: 50 (+0) | Paint: 2,307.71 ms 🔺+477.99 ms(+26.1%)
…and 4 more (+3 within noise) — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
b0d6bb6 to
b83fbbc
Compare
Codex Review (GPT-5.5)Dominant type: 1. Bugs / Issues (None)I did not find any concrete blocking or non-blocking issues in the implementation. Root Cause & Patch AssessmentThe fix targets the shared active-trigger reconciliation point in The microtask guard is doing useful work here: it avoids closing if the same trigger remounts before the deferred check runs, and it respects canceled Test Coverage AssessmentCoverage looks proportionate for this bug. The PR adds utility-level coverage for unregistering the active trigger and Chromium tooltip coverage for both contained and detached triggers, including a canceled close path. I ran: pnpm test:jsdom popupStoreUtils --no-watch
pnpm test:chromium TooltipRoot.detached-triggers --no-watch
pnpm typescriptAll passed. I did not replay the new regression assertions against RecommendationApprove ✅ The change is narrowly scoped, covered at the shared utility and Tooltip integration levels, and the relevant targeted tests plus typecheck pass. |
Summary
Bug
When the active trigger unmounts, unregistering removes the DOM node from the trigger map but leaves the active trigger id/element in store state. Conditional or virtualized triggers can then leave the tooltip open against stale anchor state instead of closing.
Reproduction
Test plan
pnpm test:jsdom popupStoreUtils --no-watchpnpm test:chromium TooltipRoot.detached-triggers --no-watch