Skip to content

fix(Tooltip): close trigger on pointerdown for any pointer button - #2101

Merged
huntabyte merged 1 commit into
huntabyte:mainfrom
MathiasWP:fix-bits-ui-issue-2099
Aug 19, 2026
Merged

fix(Tooltip): close trigger on pointerdown for any pointer button#2101
huntabyte merged 1 commit into
huntabyte:mainfrom
MathiasWP:fix-bits-ui-issue-2099

Conversation

@MathiasWP

@MathiasWP MathiasWP commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Closes #2099

Tooltip.Trigger only closed from its click handler, so right and middle click left the tooltip open under the native context menu. The dismissible layer doesn't catch it either — it rejects outside interactions with e.button > 0.

Close on pointerdown regardless of button, as Radix does. The handler already had the matching isPointerDown + pointerup bookkeeping; only the close was missing.

Two notes:

  • Gated by disableCloseOnTriggerClick, matching onInteractOutside, which already exempts the trigger when that prop is set.
  • Cancelling a pending open is split from closing. handleClose() writes open.current = false unconditionally, which would fire a spurious onOpenChange(false) on every pointerdown; cancelPendingOpen() just stops the timer.

Also fixed the disableCloseOnTriggerClick API-reference description, which described the escape key.

Five tests added; three fail without the fix. Middle-click and pending-open use a synthetic pointerdown because WebKit intermittently delivers no events at all for click({ button: "middle" }).

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5dde078

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bits-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Aug 10, 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 5dde078

Tooltip.Trigger only closed on `click`, so right and middle click left an
open tooltip sitting under the native context menu. Close on `pointerdown`
instead (as Radix does), which also cancels a pending delayed open so the
tooltip can no longer appear after the context menu has opened.

Gated by `disableCloseOnTriggerClick` so the prop keeps meaning "the trigger
doesn't dismiss", matching the existing `onInteractOutside` exemption.

Closes huntabyte#2099

@huntabyte huntabyte left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you!

@huntabyte
huntabyte merged commit 7196014 into huntabyte:main Aug 19, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 19, 2026
dadezzz pushed a commit to dadezzz/events-cash-register that referenced this pull request Aug 24, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [bits-ui](https://github.com/huntabyte/bits-ui) | [`2.18.2` → `2.19.0`](https://renovatebot.com/diffs/npm/bits-ui/2.18.2/2.19.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/bits-ui/2.19.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/bits-ui/2.18.2/2.19.0?slim=true) |

---

### Release Notes

<details>
<summary>huntabyte/bits-ui (bits-ui)</summary>

### [`v2.19.0`](https://github.com/huntabyte/bits-ui/releases/tag/bits-ui%402.19.0)

[Compare Source](https://github.com/huntabyte/bits-ui/compare/bits-ui@2.18.2...bits-ui@2.19.0)

##### Minor Changes

- feat(Checkbox): pass `form` to the hidden input ([#&#8203;2089](huntabyte/bits-ui#2089))

##### Patch Changes

- fix(DateField): keep focus on the year while correcting its first digit ([#&#8203;2100](huntabyte/bits-ui#2100))

- fix(Tooltip): close `Tooltip.Trigger` on `pointerdown` for any pointer button so right/middle click dismiss the tooltip and cancel a pending delayed open ([#&#8203;2101](huntabyte/bits-ui#2101))

- fix(RadioGroup): don't select item on pointer-driven focus- [#&#8203;2098](huntabyte/bits-ui#2098) ([#&#8203;2098](huntabyte/bits-ui#2098))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDQuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
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.Trigger does not close on right/middle click (pointerdown close missing from Radix port)

2 participants