fix(tooltip): prevent delayed tooltip after target moves - #17474
fix(tooltip): prevent delayed tooltip after target moves#17474viktorkombov wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
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. |
mddragnev
left a comment
There was a problem hiding this comment.
Wait, isn't that too much? Can't we just check wether the element itself has :hover over it? I mean in the _showTooltip timeout where the tooltip really opens.
@mddragnev, That’s why we need to run our own check when the delay expires using |
|
I disagree. However, I am only verifiying if this is working so i`ll let the reviewers look at it |
Thanks for raising this. I simplified the implementation further and removed the I also checked
So The current implementation only captures the initial pointer coordinates and checks |
|
@mddragnev, You were right. I rechecked the behavior and my earlier conclusion about I reverted the coordinate and I also updated the regression test to simulate the hover state explicitly, since dispatching synthetic pointer events in Karma does not update the Thanks for pushing back, and apologies for the incorrect initial response. |
Closes #17465
Description
Fixes delayed tooltips opening after grid virtualization moves their target away from the pointer without emitting
pointerleave.Implementation
For delayed hover interactions, the tooltip captures the initial pointer coordinates and uses
elementFromPoint()to verify that the target is still under the pointer before opening.Zero-delay tooltips, non-hover triggers, and programmatic opening keep their previous behavior.
Tests
Added regression coverage verifying that:
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):
Component(s) / Area(s) Affected:
Tooltip; virtualized grid tooltip targets.
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
N/A
Checklist:
feature/README.MDupdatesCHANGELOG.MDupdatesng updatemigrations