Skip to content

[tooltip] Close when active trigger unmounts#4886

Draft
michaldudak wants to merge 3 commits into
mui:masterfrom
michaldudak:codex/tooltip-active-trigger-removal-close
Draft

[tooltip] Close when active trigger unmounts#4886
michaldudak wants to merge 3 commits into
mui:masterfrom
michaldudak:codex/tooltip-active-trigger-removal-close

Conversation

@michaldudak
Copy link
Copy Markdown
Member

@michaldudak michaldudak commented May 22, 2026

Summary

  • Clear stale active-trigger state when the active trigger unregisters while the tooltip is open.
  • Close the tooltip instead of implicitly re-anchoring it to another trigger.
  • Cover contained and detached trigger removal.

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-watch
  • pnpm test:chromium TooltipRoot.detached-triggers --no-watch

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

commit: 1343bd5

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 22, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+503B(+0.11%) 🔺+122B(+0.08%)

Details of bundle changes

Performance

Total duration: 1,640.79 ms +249.14 ms(+17.9%) | Renders: 50 (+0) | Paint: 2,473.95 ms +344.89 ms(+16.2%)

Test Duration Renders
Slider mount (300 instances) 266.26 ms 🔺+88.16 ms(+49.5%) 3 (+0)
Checkbox mount (500 instances) 104.38 ms 🔺+36.77 ms(+54.4%) 1 (+0)
Dialog mount (300 instances) 84.39 ms 🔺+25.30 ms(+42.8%) 1 (+0)
Tooltip mount (300 contained roots) 85.53 ms 🔺+23.34 ms(+37.5%) 1 (+0)

8 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@michaldudak michaldudak added type: bug It doesn't behave as expected. component: tooltip Changes related to the tooltip component. labels May 22, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1343bd5
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a103f13db9e19000840c3c0
😎 Deploy Preview https://deploy-preview-4886--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@michaldudak michaldudak force-pushed the codex/tooltip-active-trigger-removal-close branch from b0d6bb6 to b83fbbc Compare May 22, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: tooltip Changes related to the tooltip component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant