Skip to content

[tooltip] Fix provider delay group lifecycle#4887

Open
michaldudak wants to merge 1 commit into
mui:masterfrom
michaldudak:codex/tooltip-delay-group-lifecycle
Open

[tooltip] Fix provider delay group lifecycle#4887
michaldudak wants to merge 1 commit into
mui:masterfrom
michaldudak:codex/tooltip-delay-group-lifecycle

Conversation

@michaldudak
Copy link
Copy Markdown
Member

@michaldudak michaldudak commented May 22, 2026

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
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

commit: c747e4d

@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 🔺+220B(+0.05%) 🔺+81B(+0.05%)

Details of bundle changes

Performance

Total duration: 1,339.59 ms -52.06 ms(-3.7%) | Renders: 50 (+0) | Paint: 2,053.74 ms -75.32 ms(-3.5%)

Test Duration Renders
Select open (500 options) 58.62 ms 🔺+12.35 ms(+26.7%) 14 (+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
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 c747e4d
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a101d0ee0412a0008af7372
😎 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
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