Skip to content

fix(tooltip): prevent delayed tooltip after target moves - 21.2.x - #17476

Open
viktorkombov wants to merge 1 commit into
21.2.xfrom
vkombov/fix-17465-21.2.x
Open

fix(tooltip): prevent delayed tooltip after target moves - 21.2.x#17476
viktorkombov wants to merge 1 commit into
21.2.xfrom
vkombov/fix-17465-21.2.x

Conversation

@viktorkombov

Copy link
Copy Markdown
Contributor

Closes #17465

Description

Fixes delayed tooltips opening after their target has moved away from the pointer.

This could occur when layout changes—particularly during grid virtualization—move or recycle a target during showDelay without the browser emitting pointerleave. The pending timeout would then open a stale tooltip, sometimes resulting in incorrectly positioned or multiple visible tooltips.

Implementation

For delayed hover interactions, IgxTooltipTargetDirective now:

  • Tracks the latest pointer position.
  • Uses elementFromPoint() before opening.
  • Opens only when the target remains under the pointer.
  • Supports targets inside both document and Shadow DOM roots.

The validation is limited to delayed hover interactions. Zero-delay tooltips, focus/click triggers, showTooltip(), and coordinate-less synthetic events preserve their previous behavior.

The fix is contained within the tooltip directive and does not introduce grid-specific handling.

Tests

Added regression coverage verifying that:

  • A delayed tooltip remains closed when its target moves away.
  • Zero-delay hover interactions are not hit-tested.
  • The latest pointer position is used before opening.

Tooltip test suite: 67/67 passing.

Components Affected

Tooltip, including tooltip targets rendered inside virtualized Grid, Tree Grid, and Hierarchical Grid cells.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copilot AI left a comment

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.

Pull request overview

Fixes a tooltip regression where a delayed hover tooltip could still open after its target element has moved (e.g., during Grid virtualization) without a corresponding pointerleave, by validating the pending delayed-open against the current hit-tested element under the pointer.

Changes:

  • Track the latest pointer coordinates during delayed hover interactions and validate at timeout completion before opening.
  • Use elementFromPoint() against the appropriate DocumentOrShadowRoot to ensure the tooltip target is still under the pointer.
  • Add regression tests covering “target moved during showDelay”, “no hit-test for zero showDelay”, and “latest pointer position wins”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
projects/igniteui-angular/directives/src/directives/tooltip/tooltip-target.directive.ts Adds delayed-hover pointer tracking + hit-testing gate before opening to prevent stale delayed tooltips.
projects/igniteui-angular/directives/src/directives/tooltip/tooltip.directive.spec.ts Adds regression coverage for the delayed-hover hit-testing behavior and updates the hover helper to pass pointer coordinates.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants