-
Notifications
You must be signed in to change notification settings - Fork 159
fix(tooltip/snackbar): use overlay service size helpers - master #16837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
wnvko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we know this PR is breaking the tooltip. What is the reason this happening? Can we revert the change that made this happen?
Adding this additional property to the overlay settings and use it in this way in the tooltip looks like a breaking change. IMO it will be better to find out what happened in the above mentioned PR and to revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
projects/igniteui-angular/snackbar/src/snackbar/snackbar.component.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
| /** | ||
| * Measures the element's initial size and controls *when* the element is moved into the overlay outlet. | ||
| * | ||
| * The elements inherit constraining parent styles, so | ||
| * for some of them (e.g., Tooltip, Snackbar) their pre-move size is incorrect. | ||
| * Those can **override** this method to measure **after** moving to get an accurate size. | ||
| * | ||
| * - **Default**: Measures in-place (current parent), then moves to the overlay. | ||
| * | ||
| * @param info OverlayInfo for the content being attached. | ||
| * @param moveToOverlay Moves the element into the overlay. | ||
| */ | ||
| private setInitialSize(info: OverlayInfo, moveToOverlay: () => void): void { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc/comment claims consumers can “override this method”, but setInitialSize is private, so it can’t be overridden. The actual extension mechanism is OverlaySizeRegistry.register(...). Reword the comment to reflect the registry-based override (e.g., “Components can register an override via OverlaySizeRegistry to measure after moving”).
| AbsolutePosition, ConnectedFit, HorizontalAlignment, OffsetMode, OverlayAnimationEventArgs, OverlayCancelableEventArgs, OverlayClosingEventArgs, | ||
| OverlayCreateSettings, OverlayEventArgs, OverlaySettings, Point, PositionSettings, RelativePosition, RelativePositionStrategy, Size, VerticalAlignment, Util, | ||
| IgxOverlayOutletDirective | ||
| IgxOverlayOutletDirective, OverlayInfo, OverlaySizeRegistry |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OverlaySizeRegistry is introduced in utilities.ts with @hidden @internal JSDoc, but it’s now re-exported from the core public API. This is inconsistent and may unintentionally expose an internal hook to library consumers. Either (1) keep it public and remove/adjust the @internal marker + add minimal API docs, or (2) avoid re-exporting it from the public entrypoint and instead consume it via an internal/shared entrypoint intended for cross-package internals.
| IgxOverlayOutletDirective, OverlayInfo, OverlaySizeRegistry | |
| IgxOverlayOutletDirective, OverlayInfo |
projects/igniteui-angular/test-utils/tooltip-components.spec.ts
Outdated
Show resolved
Hide resolved
|
@wnvko The linked PR does not break the tooltip. This PR was merged in version 20.1.0, but the behavior is observed in version 15.0.x too (maybe even before that, but I tested with that version). The PR adds a lot of changes, but the one that is related to the current behavior is adding this CSS: min-width: rem(24px);
max-width: rem(200px);
width: fit-content;The new styles did not break the tooltip, but revealed the already broken behavior. Overall, it is due to the element's size (width) being measured before being moved to the overlay content. If the element does not have a specific width set, like 100px, its size is affected by the styles that come from the parent container. For example, consider this template: <div style="background: red; text-transform: uppercase; letter-spacing: 8px;" [igxTooltipTarget]="themeTooltipRef4">
Parent Element
<div #themeTooltipRef4="tooltip" igxTooltip>Click to toggle between dark/light themes</div>
</div>The parent element (red div) has these styles However, the result is the following: That's because the tooltip/element is measured and then moved to the overlay. While being measured, the tooltip is affected by the styles of the parent, and a bigger size is set as the The snackbar behavior is due to this PR. Not exactly breaking it, since before this PR, the snackbar had no size (perhaps because it was not present in the view yet) I removed the additional property from the overlay settings and implemented a different approach, but similar to the previous one, it requires moving the element to the overlay and then getting its size. |






Closes #16458
Additional information (check all that apply):
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)