Skip to content

fix(tooltip): prevent delayed tooltip after target moves - #17474

Open
viktorkombov wants to merge 1 commit into
masterfrom
vkombov/fix-17465
Open

fix(tooltip): prevent delayed tooltip after target moves#17474
viktorkombov wants to merge 1 commit into
masterfrom
vkombov/fix-17465

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 timing edge case where a delayed hover tooltip could still open after its target moved (e.g., during grid virtualization/scroll) without a corresponding pointerleave, leading to stale/mispositioned or multiple visible tooltips.

Changes:

  • Track the last known pointer coordinates for delayed hover-triggered shows and revalidate via elementFromPoint() right before opening.
  • Add Shadow DOM-aware hit testing by using the element’s root (getRootNode()) when available, with a safe fallback.
  • Add regression unit tests covering target movement during delay, no hit-testing for zero-delay, and using the latest pointer position.

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 position tracking + hit-test validation (incl. Shadow DOM root support) before opening the tooltip.
projects/igniteui-angular/directives/src/directives/tooltip/tooltip.directive.spec.ts Adds regression coverage for delayed-hover validation and updates the hover helper to allow 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.

igxTooltip in igxCell shows multiple instances and becomes "mispositioned" during grid scroll

2 participants