refactor(overlay): stop moving to body container & deprecate outlet#16989
refactor(overlay): stop moving to body container & deprecate outlet#16989
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces an opt-in keepInPlace flag for OverlaySettings to prevent overlay content from being moved to a centralized overlay container, and begins deprecating OverlaySettings.outlet in favor of the new behavior.
Changes:
- Added
keepInPlace?: booleantoOverlaySettingsand implemented in-place wrapping/unwrapping logic inIgxOverlayService. - Deprecated
OverlaySettings.outletand updated multiple feature READMEs + changelog to document the new option. - Updated grid/pivot-grid filtering overlay settings and adjusted dialog/overlay tests to account for in-place wrapping behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/igniteui-angular/core/src/services/overlay/utilities.ts | Adds keepInPlace to OverlaySettings; marks outlet as deprecated. |
| projects/igniteui-angular/core/src/services/overlay/overlay.ts | Implements in-place wrapping path for overlays + cleanup changes. |
| projects/igniteui-angular/core/src/services/overlay/overlay.spec.ts | Adds unit tests validating keep-in-place wrapping/unwrapping and mixed modes. |
| projects/igniteui-angular/grids/grid/src/grid-base.directive.ts | Sets keepInPlace on grid filter and advanced filtering overlay settings. |
| projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts | Sets keepInPlace on pivot grid ESF filter overlay settings. |
| projects/igniteui-angular/directives/src/directives/toggle/toggle.directive.ts | Defaults toggle attach to { keepInPlace: true, ...overlaySettings }. |
| projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts | Updates assertions to locate wrapper within the component host when in-place wrapping is used. |
| projects/igniteui-angular/core/src/services/overlay/README.md | Documents keepInPlace and deprecates outlet in docs. |
| projects/igniteui-angular/core/src/services/overlay/position/README.md | Notes outlet deprecation in positioning docs. |
| projects/igniteui-angular/drop-down/src/drop-down/autocomplete/README.md | Updates autocomplete overlay settings docs; notes outlet deprecation. |
| projects/igniteui-angular/directives/src/directives/toggle/README.md | Deprecates igxToggleOutlet docs and adds keepInPlace guidance. |
| projects/igniteui-angular/date-picker/src/date-picker/README.md | Marks date-picker outlet as deprecated in docs. |
| projects/igniteui-angular/date-picker/src/date-range-picker/README.md | Marks date-range-picker outlet as deprecated in docs. |
| CHANGELOG.md | Adds an entry for the new keepInPlace feature and outlet deprecation. |
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/utilities.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/position/README.md
Outdated
Show resolved
Hide resolved
1b73b1b to
73ce1fa
Compare
51e13b3 to
62135bb
Compare
projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid-base.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/core/src/common/grid.interface.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/drop-down/src/drop-down/autocomplete/README.md
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/directives/src/directives/toggle/README.md
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/directives/src/directives/notification/notifications.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/date-picker/src/date-range-picker/README.md
Outdated
Show resolved
Hide resolved
32e9669 to
7b59366
Compare
7b59366 to
66c36b1
Compare
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Fixed
Show fixed
Hide fixed
2ded560 to
91d3085
Compare
damyanpetev
left a comment
There was a problem hiding this comment.
Might need to discuss the additional container properties, as I missed how that strategy worked before and those might be redundant, which will shift a few more things around.
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/core/src/services/overlay/position/README.md
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Outdated
Show resolved
Hide resolved
6345acb to
2d07772
Compare
2d07772 to
5ac8768
Compare
projects/igniteui-angular/core/src/services/overlay/position/container-position-strategy.ts
Fixed
Show fixed
Hide fixed
projects/igniteui-angular/date-picker/src/date-range-picker/date-range-picker.component.ts
Outdated
Show resolved
Hide resolved
| /** | ||
| * Generates an Id. Provide this Id when calling the `show(id)` method | ||
| * | ||
| * @note If `viewContainerRef` is not provided, the component is created in the root scope and attached to the document body. |
There was a problem hiding this comment.
Eh, that's the overload with the viewContainerRef, if you want to add this message, perhaps add it to the other overload without and guide users to prefer using this one.
| info.wrapperElement = this.getWrapperElement(); | ||
| const contentElement = this.getContentElement(info.wrapperElement, info.settings.modal); | ||
| if (info.settings.positionStrategy instanceof ContainerPositionStrategy) { | ||
| this.moveElementToContainer(info); |
There was a problem hiding this comment.
Should be mentioned this is to be a temporary measure, no? Also not really moving, merely adding an extra absolute positioned wrapper
| @HostListener('keydown.alt.arrowup', ['$event']) | ||
| public onEscape(event) { | ||
| event.preventDefault(); | ||
| event.stopPropagation(); |
There was a problem hiding this comment.
Wouldn't mind a comment why this is here - i.e. to avoid the host picker handler doing this again and possibly should be refactored to avoid the conflicting handlers
|
|
||
| private get viewContainerRef(): ViewContainerRef { | ||
| return this._viewContainerRef; | ||
| } |
There was a problem hiding this comment.
Mind reverting the getter now that's not needed anymore?
| /** | ||
| * @deprecated in version 21.2.0. Overlays now use the HTML Popover API and no longer move to the document | ||
| * body by default, so using outlet is also no longer needed - just define the overlay in the intended | ||
| * DOM tree position instead or use `container` property instead. | ||
| */ | ||
| @ViewChild('overlayOutlet', { read: IgxOverlayOutletDirective, static: true }) | ||
| public overlayOutlet: IgxOverlayOutletDirective; |
There was a problem hiding this comment.
That's internal component, so this should just be refactored away and removed
| /** | ||
| * Gets/Sets the container used for the element. | ||
| * | ||
| * @remarks | ||
| * `container` is an instance of `HTMLElement`. | ||
| */ | ||
| @Input() | ||
| public useContainer: boolean; |
There was a problem hiding this comment.
Gets/Sets the container used for the element.
Um, moe like setting if the snackbar should position itself relatively to a container (instead of a viewport)
There was a problem hiding this comment.
Kinda want to consider alternative names for this one too - possibly position: 'global | relative' = 'global' or just a relative bool flag. Not settled on that yet
| */ | ||
| public showSnackbarFor(index: number) { | ||
| this.addRowSnackbar.actionText = index === -1 ? '' : this.resourceStrings.igx_grid_snackbar_addrow_actiontext; | ||
| this.addRowSnackbar.useContainer = true; |
There was a problem hiding this comment.
Could just add this in markup
There was a problem hiding this comment.
this should be done in grid, hierarchical grid, tree grid and so on. This is why I prefer to have it at single place here.
Closes #16825
Closes #17041
Related #16861
With this PR we are introducing
keepInPlaceproperty inOverlaySettings. When set totrueoverlay will not move the element to be shown out of its position. Instead the element will be wrapped in a content element and in a wrapper element. The new property default value isfalseto keep the current behavior.With this PR we also deprecate the
outletproperty ofOverlaySettings. This is not needed anymore as overlay element could be kept in its original position via the newkeepInPlaceproperty.Next steps:
outlet.keepInPlacedefault value true and deprecate it.keepInPlaceand always keep the overlay element at its original position.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)