Skip to content

Commit 5bf0487

Browse files
devversionjelbourn
authored andcommitted
fix(propover-edit): incorrect template root note retrieved in ivy
Currently the popover-edit hover directive retrieves the root node of the embedded view for the popover by looking at the next sibling of the directive host element. This worked fine in view engine where the inserted view was added after the current host element, but in Ivy, the embedded view seems to be inserted before the directive host node (which is a comment node). The popover directive should not rely on the implementation detail of the embedded view insertion and rather retrieve the embedded view root node through the `EmbeddedViewRef`.
1 parent e774692 commit 5bf0487

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cdk-experimental/popover-edit/table-directives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ export class CdkRowHoverContent implements AfterViewInit, OnDestroy {
374374
// Not doing any positioning in CDK version. Material version
375375
// will absolutely position on right edge of cell.
376376
this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, {});
377-
this.initElement(this.elementRef.nativeElement!.nextSibling as HTMLElement);
377+
this.initElement(this.viewRef.rootNodes[0] as HTMLElement);
378378
} else {
379379
this.viewContainerRef.insert(this.viewRef);
380380
}
381-
this.prepareElement(this.elementRef.nativeElement!.nextSibling as HTMLElement);
381+
this.prepareElement(this.viewRef.rootNodes[0] as HTMLElement);
382382
} else if (this.viewRef) {
383383
this.viewContainerRef.detach(this.viewContainerRef.indexOf(this.viewRef));
384384
}

0 commit comments

Comments
 (0)