From 743fe4333861bf90b1c3d5e3e9345d8d1792ab1c Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 14 Nov 2025 11:39:21 +0100 Subject: [PATCH] refactor(cdk/overlay): address internal issue Adds a workaround for an internal issue in the CDK overlay. --- src/cdk/overlay/overlay.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cdk/overlay/overlay.ts b/src/cdk/overlay/overlay.ts index 6d0176fdc25c..a52742866812 100644 --- a/src/cdk/overlay/overlay.ts +++ b/src/cdk/overlay/overlay.ts @@ -89,10 +89,13 @@ export function createOverlayRef(injector: Injector, config?: OverlayConfig): Ov ? overlayConfig.positionStrategy?.getPopoverInsertionPoint?.() : null; + overlayContainer.getContainerElement().appendChild(host); + + // Note: it's redundant to pass the `host` through the container element above if + // it's going to end up at the custom insertion point anyways. We need to do it, + // because some internal clients depend on the host passing through the container first. if (customInsertionPoint) { customInsertionPoint.after(host); - } else { - overlayContainer.getContainerElement().appendChild(host); } return new OverlayRef(