Repository navigation
Conversation
Port of the master change to 21.2.x. The new tests are written for Jasmine. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved tooltip positioning defects can leave tooltips offset or clipped after movement and resizing, and misalign arrows when viewport correction requires a zero offset.
4 open issues
What changed in this PR
Ports the tooltip layout and arrow-positioning fixes from #17880 to 21.2.x, addressing #17879 in Ignite UI for Angular.
Changes:
- Adds layout observers to reposition open tooltips when their target moves or dimensions change.
- Adjusts arrow positioning for viewport pushes and scaled opening animations.
- Adds Jasmine regression tests, usage documentation, and a
21.2.28changelog entry.
| File | Description |
|---|---|
projects/igniteui-angular/directives/src/directives/tooltip/tooltip.directive.ts |
Manages layout observation, resizing, and repositioning. |
projects/igniteui-angular/directives/src/directives/tooltip/tooltip.directive.spec.ts |
Adds layout and arrow regression tests; updates nested-arrow assertions. |
projects/igniteui-angular/directives/src/directives/tooltip/tooltip.common.ts |
Compensates arrows for viewport pushes and uses unscaled layout sizes. |
projects/igniteui-angular/directives/src/directives/tooltip/tooltip-layout-observer.ts |
Observes size and target-position changes with frame-batched updates. |
projects/igniteui-angular/directives/src/directives/tooltip/README.md |
Documents layout tracking and arrow correction. |
CHANGELOG.md |
Records the tooltip fixes under 21.2.28. |
Review effort: Balanced
- watch the border box, so padding and border changes are reported - watch the target again after it resizes - report a move that happens before the first observer entry - fit a moved tooltip into the viewport anew - keep a zero arrow offset after a push Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 tasks done
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #17879
Description
IgxTooltipDirective: while the tooltip is open, it follows changes of its own size and of the size and the position of its target. A new internalobserveTooltipLayout()(tooltip-layout-observer.ts) watches the tooltip and the target with aResizeObserver, and the target position with anIntersectionObserverwhose root is shrunk to the target, so a move without a size change is caught too. Changes are batched to one update per frame.TooltipPositionStrategy:fitInViewportpushes the tooltip with atranslateX/translateY, the arrow moves back by the same amount and stays inside the tooltip, clear of its rounded corners, so it keeps pointing at the target. Astartaligned arrow, which has no position style, is moved from its edge offset, the same one as anendaligned arrow.offsetWidth/offsetHeight) instead ofgetBoundingClientRect(), so a reposition while thescaleInCenteropen animation runs no longer places it for the scaled-down tooltip.0px. Before, it left the arrow at its default place, next to a target that is at the very start of the tooltip.Motivation / Context
In the Tooltip Overview sample, switching the theme with the documentation's theme picker while the sticky tooltip is open left the tooltip about 50px below its target, with its text wrapped to 4 lines in the width fixed for the previous theme. Turning off the close button left the smaller tooltip about 13px off center. In narrow sample frames, the arrow pointed next to the target. See #17879.
This is the port of #17880 to
21.2.x. The code is the same as in themasterpull request. The new tests are written for Jasmine instead of Vitest, and the changelog entry is under21.2.28.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Tooltip
How Has This Been Tested?
Unit tests:
tooltip-layout-observer.spec.tswith 8 tests for the observer, and 4 more tests for the directive: a move after the target has shrunk, a move over several frames, a new viewport fit after a move, and a zero arrow offset. Each of the five review findings has a test that fails without its fix.Manual testing, in the dev demos with the Tooltip Overview sample of igniteui-angular-samples, the four theme presets switched at runtime as the samples' theme service does, and the master
TooltipPositionStrategyside by side for comparison:Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsCHANGELOG.MDupdates for newly added functionality🤖 Generated with Claude Code