Skip to content

refactor(tooltip): improve tooltip show timing#1514

Closed
dauriamarco wants to merge 1 commit intomainfrom
refactor/tooltip-pointer
Closed

refactor(tooltip): improve tooltip show timing#1514
dauriamarco wants to merge 1 commit intomainfrom
refactor/tooltip-pointer

Conversation

@dauriamarco
Copy link
Member

Adds pointerdown event handling to improve tooltip display timing.


@dauriamarco dauriamarco added this to the 49.x milestone Feb 12, 2026
@dauriamarco dauriamarco self-assigned this Feb 12, 2026
@dauriamarco dauriamarco requested review from a team as code owners February 12, 2026 13:34
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a change to improve the tooltip display timing by differentiating between focus events triggered by keyboard and those by mouse clicks. It adds a pointerdown event listener and a flag to delay showing the tooltip on click, making the behavior consistent with hover.

The implementation is generally good, but there's a potential edge case where the isPointerDown flag could get stuck in a true state, affecting subsequent interactions. I've added a suggestion to make the flag's state transient and avoid this issue. Otherwise, the changes look correct and address the intended goal.

Comment on lines +108 to 110
protected pointerDown(): void {
this.isPointerDown = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The isPointerDown flag is set here but only reset when the tooltip is shown or hidden. If a pointerdown event occurs without a corresponding show/hide action (e.g., on a non-focusable element), the flag can get stuck as true. This could cause future keyboard focus events to be incorrectly delayed.

To prevent this, the flag should be reset automatically after the event sequence. Using setTimeout ensures the flag is transient, covering the pointerdown -> focus sequence without affecting later, unrelated focus events.

Suggested change
protected pointerDown(): void {
this.isPointerDown = true;
}
protected pointerDown(): void {
this.isPointerDown = true;
setTimeout(() => (this.isPointerDown = false), 0);
}

@github-actions
Copy link

Code Coverage

@github-actions
Copy link

@dauriamarco
Copy link
Member Author

Closing this in favor of #1517.

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.

1 participant