Skip to content

[tooltip] Fix provider delay group lifecycle - #4887

Merged
michaldudak merged 3 commits into
mui:masterfrom
michaldudak:codex/tooltip-delay-group-lifecycle
May 29, 2026
Merged

michaldudak merged 3 commits into
mui:masterfrom
michaldudak:codex/tooltip-delay-group-lifecycle

Conversation

@michaldudak

@michaldudak michaldudak commented May 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Keep FloatingDelayGroup's initial delay ref synced with Tooltip.Provider prop updates.
  • Preserve the active delay-group context when an inactive consumer unmounts.
  • Add regression coverage for updated closeDelay and inactive cleanup.

Bug

FloatingDelayGroup captures the initial delay only once, so later Tooltip.Provider closeDelay updates are ignored. Its cleanup also clears the shared current context for any consumer unmount, meaning an inactive tooltip unmount can prevent the next tooltip from closing the active one.

Reproduction

Test plan

  • pnpm test:jsdom FloatingDelayGroup --no-watch
  • pnpm test:jsdom TooltipProvider --no-watch
  • pnpm test:chromium TooltipProvider --no-watch
  • pnpm eslint
  • pnpm typescript

@pkg-pr-new

pkg-pr-new Bot commented May 22, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@4887
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4887
    

commit: 117f3ea

@code-infra-dashboard

code-infra-dashboard Bot commented May 22, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+375B(+0.08%) 🔺+128B(+0.09%)

Details of bundle changes

Performance

Total duration: 1,274.18 ms +44.44 ms(+3.6%) | Renders: 50 (+0) | Paint: 1,920.37 ms +37.04 ms(+2.0%)

Test Duration Renders
Mixed surface mount (app-like density) 91.86 ms 🔺+19.60 ms(+27.1%) 5 (+0)

11 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

netlify Bot commented May 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 117f3ea
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a1954a8abaa1200088506f3
😎 Deploy Preview https://deploy-preview-4887--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.

Copy link
Copy Markdown
Member Author

Codex Review (GPT-5.5)

Dominant type: bug-fix, with regression-test coverage. I reviewed the full PR diff against freshly fetched upstream/master; the lifecycle fix is narrow and matches the Tooltip delay-group failure modes it targets.

1. Bugs / Issues (None)

No actionable issues found.

Root Cause & Patch Assessment

The patch addresses the two relevant root causes: inactive consumers no longer clear the active delay-group context on unmount, and provider delay changes now refresh the backing refs without breaking the current instant-open phase. The cleanup now keys off the active floatingId, and active unmounts reset the id, context, delay ref, and pending timeout together.

Test Coverage Assessment

Coverage is well targeted. The new FloatingDelayGroup test fails on upstream/master when only the test change is applied, and passes on this branch. The new Tooltip.Provider close-delay update test also fails on upstream/master and passes on this branch.

Validated:

  • pnpm test:jsdom FloatingDelayGroup --no-watch
  • pnpm test:jsdom TooltipProvider --no-watch
  • pnpm exec eslint packages/react/src/floating-ui-react/components/FloatingDelayGroup.tsx packages/react/src/floating-ui-react/components/FloatingDelayGroup.test.tsx packages/react/src/tooltip/provider/TooltipProvider.test.tsx --max-warnings 0 --report-unused-disable-directives

Recommendation

Approve ✅

The change is small, focused, and has regression tests that demonstrate the previous behavior was broken against the fresh base branch.

@michaldudak
michaldudak marked this pull request as ready for review May 22, 2026 10:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4bd44f7c67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@michaldudak
michaldudak merged commit eaf30dc into mui:master May 29, 2026
6 checks passed
@michaldudak
michaldudak deleted the codex/tooltip-delay-group-lifecycle branch May 29, 2026 09:02
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