Skip to content

Fix: Tooltip captures click, blocking intent#77415

Closed
DarkMatter-999 wants to merge 3 commits intoWordPress:trunkfrom
DarkMatter-999:fix/tooltip-captures-click
Closed

Fix: Tooltip captures click, blocking intent#77415
DarkMatter-999 wants to merge 3 commits intoWordPress:trunkfrom
DarkMatter-999:fix/tooltip-captures-click

Conversation

@DarkMatter-999
Copy link
Copy Markdown
Contributor

What?

Closes #73785

Prevents tooltip from capturing pointer events, allowing clicks to pass through to elements beneath it.

Why?

When hovering over an element that triggers a tooltip, the tooltip could physically overlap other UI elements. Clicking in that area would be captured by the tooltip rather than reaching the intended element below, unlike native OS tooltips, which are always transparent to pointer interaction.

How?

Two props are added to <Ariakit.Tooltip>:

  • disablePointerEventsOnApproach={false} - disables the hover-intent pointer lock, so surrounding elements remain interactive while the tooltip is visible.
  • wrapperProps={{ style: { pointerEvents: 'none' } }} - makes the tooltip wrapper element transparent to pointer events, so any click passes through directly to the element below.

Together these replicate how OS-native tooltips behave: purely visual, never intercepting mouse interaction.

Testing Instructions

  1. Open a post or page in the block editor.
  2. In the toolbar, hover over the site logo / home button (top left) until the "View Posts" tooltip appears.
  3. While the tooltip is visible and overlapping the inserter button (or any adjacent control), click.
  4. Confirm the click is received by the element beneath the tooltip, and the tooltip moves out of the way.
  5. Confirm the tooltip still appears and disappears normally on hover.

Screenshots or screencast

Before:

tooltip-hover.mov

After:

tooltip-fix.mov

Use of AI Tools

Claude Sonnet 4.6 was used to help analyze the Ariakit API, and draft this PR description.

@github-actions github-actions Bot added the [Package] Components /packages/components label Apr 16, 2026
@DarkMatter-999 DarkMatter-999 marked this pull request as ready for review April 16, 2026 08:49
@DarkMatter-999 DarkMatter-999 requested review from a team and ajitbohra as code owners April 16, 2026 08:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DarkMatter-999 <lakshyajeet@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: lukecarbis <lukecarbis@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mirka mirka added the [Type] Enhancement A suggestion for improvement. label Apr 16, 2026
overflowPadding={ 0.5 }
store={ tooltipStore }
disablePointerEventsOnApproach={ false }
wrapperProps={ { style: { pointerEvents: 'none' } } }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be moved to packages/components/src/tooltip/style.scss ?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the @wordpress/components Tooltip so it behaves more like native OS tooltips by not intercepting pointer interactions, preventing tooltips from blocking clicks on nearby UI.

Changes:

  • Configure Ariakit.Tooltip to avoid pointer-event locking behavior and make the tooltip wrapper transparent to pointer events.
  • Add a changelog entry documenting the bug fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/components/src/tooltip/index.tsx Makes tooltip wrapper click-through via Ariakit tooltip props and pointerEvents: 'none'.
packages/components/CHANGELOG.md Documents the Tooltip pointer-event bug fix in Unreleased notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +126 to +127
disablePointerEventsOnApproach={ false }
wrapperProps={ { style: { pointerEvents: 'none' } } }
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

New behavior (making tooltips click-through) isn’t currently covered by unit tests. Since this change is implemented via Ariakit props + pointerEvents: 'none', please add a Tooltip test that asserts the rendered tooltip wrapper (or tooltip element, depending on Ariakit’s DOM structure) has pointer-events: none (or otherwise verifies clicks aren’t intercepted) to prevent regressions.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@ciampo ciampo Apr 21, 2026

Choose a reason for hiding this comment

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

I'm afraid we won't be able to test this in unit tests with the current jsdom-based setup

@mirka
Copy link
Copy Markdown
Member

mirka commented Apr 21, 2026

One question though. In the case in the video for example, wouldn't the straightforward fix be to alter the tooltip position to bottom, like the other ones? I feel like this is something to be addressed with optimal positioning, not with global pointer event ignores. Because pointer events are just the secondary problem, the first problem is that the interactive element you want to get to is visually obscured for no reason.

@DarkMatter-999
Copy link
Copy Markdown
Contributor Author

Hi @mirka,
Thanks for the suggestion! While moving the tooltips to the bottom might resolve the overlap in this specific case, I’m concerned that we would still run into the same issue elsewhere in the UI.

As noted in this comment, vertically stacked controls, like the move up/down block buttons would still face this problem, as a tooltip for one will naturally overlap the adjacent button. From my perspective, tooltips should be purely informational and shouldn't act as a physical barrier to the interface, so making them "click-through" feels like a more robust way to ensure they never interfere with a user's intent.

That being said, I'd love to hear your thoughts, are there any other solutions you can think of that might fix this more effectively?

image

@ciampo
Copy link
Copy Markdown
Contributor

ciampo commented Apr 22, 2026

@DarkMatter-999 in the new examlpe you showed, the issue could be avoided if the "move up" tooltip was anchored on top of the "arrow up" button.

While I understand your point, I tend to agree with @mirka and I think that we should apply the proposed changes to Tooltip only as a last resort, in case we encounter a scenario in which anchor positioning (or general spacing) can't fix it.

We could open dedicated PRs to tweak Tooltip anchoring for the site logo/home button, the block mover in the block toolbar, and any other instance.

@DarkMatter-999
Copy link
Copy Markdown
Contributor Author

Hi @ciampo,
Thanks for the review. I understand! That makes sense.
I've located the specific implementation for the site back button here: fullscreen-mode-close.js L131-L138. We can update this to placement="bottom" which would move the tooltip out of the way of the Inserter button.

			<Button
				__next40pxDefaultSize
				className={ classes }
				href={ buttonHref }
				label={ buttonLabel }
				showTooltip={ showTooltip }
-				tooltipPosition="middle right"
+				tooltipPosition="bottom"
			>

Once you confirm you'd prefer this approach, I can close this PR and open a new one (or simply pivot this PR) to address those specific positioning fixes.

This is how it looks afterwards:

image

cc: @mirka

@ciampo
Copy link
Copy Markdown
Contributor

ciampo commented Apr 22, 2026

@DarkMatter-999 yes, let's go with this approach. We can open 2 separate PRs:

  • one changing tooltip position to bottom for the site back button
  • another changing tooltip position to top for the "move block up" button in the toolbar

Make sure you tag us as reviewers, happy to help there.

@ciampo ciampo closed this Apr 23, 2026
@DarkMatter-999
Copy link
Copy Markdown
Contributor Author

Closing this in favor of: #77587 and #77588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tooltip captures your click, perhaps blocking your intent

4 participants