Skip to content

fix(Tooltip): close when any scrolling ancestor of the trigger scrolls - #2206

Merged
huntabyte merged 1 commit into
huntabyte:mainfrom
xyrolle:fix/tooltip-ancestor-scroll-capture
Oct 20, 2026
Merged

huntabyte merged 1 commit into
huntabyte:mainfrom
xyrolle:fix/tooltip-ancestor-scroll-capture

Conversation

@xyrolle

@xyrolle xyrolle commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Closes #2205.

An element's scroll event does not bubble (CSSOM View: only a Document's scroll is fired "that bubbles"), so the provider's window listener heard document scrolls only and never closed a tooltip whose trigger sits in a scrolling element. It now listens in the capture phase (passive), so the existing target.contains(triggerNode) check sees element scrolls too. Document scrolls behave as before.

The scroll test dispatched a bubbling scroll on an element, which a browser never does, so it passed without covering element scrolls. It now dispatches the event as the browser does.

Verification, on main (fd10616):

  • The corrected scroll test fails without the fix in Chromium 148 and WebKit 26.4 (all three retries) and passes with it.
  • tooltip.browser.test.ts passes in both engines with the fix. One WebKit leg ("provider: should not re-enable delay while switching between tooltips") timed out once in a loaded full-file run and passed on every re-run, with and without this change.
  • The full browser suite passes in Chromium. The WebKit failures on my machine are focus-related legs in dialog, alert-dialog, popover, dropdown-menu and link-preview that also fail on main here, and they differ from run to run.
  • svelte-check (bits-ui), prettier, oxlint and eslint are clean. The changeset is a patch.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview 7d5bc86

This branch was successfully deployed

1 active deployment
Preview — 7d5bc86f Deployed Oct 19, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tooltip: closing on scroll never fires when a scrolling element (not the page) holds the trigger

2 participants