Skip to content

Commit

Permalink
fix(propover-edit): incorrect template root note retrieved in ivy
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
devversion authored and jelbourn committed May 15, 2019
1 parent e774692 commit 5bf0487
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cdk-experimental/popover-edit/table-directives.ts
Expand Up @@ -374,11 +374,11 @@ export class CdkRowHoverContent implements AfterViewInit, OnDestroy {
// Not doing any positioning in CDK version. Material version
// will absolutely position on right edge of cell.
this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, {});
this.initElement(this.elementRef.nativeElement!.nextSibling as HTMLElement);
this.initElement(this.viewRef.rootNodes[0] as HTMLElement);
} else {
this.viewContainerRef.insert(this.viewRef);
}
this.prepareElement(this.elementRef.nativeElement!.nextSibling as HTMLElement);
this.prepareElement(this.viewRef.rootNodes[0] as HTMLElement);
} else if (this.viewRef) {
this.viewContainerRef.detach(this.viewContainerRef.indexOf(this.viewRef));
}
Expand Down

0 comments on commit 5bf0487

Please sign in to comment.