Skip to content

Commit b5a777b

Browse files
committed
tweak
1 parent a314a16 commit b5a777b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cdk/overlay/position/flexible-connected-position-strategy.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
584584
// Adjust the overly position when it is placed inline relative to its parent.
585585
const insertOverlayAfter = this._overlayRef.getConfig().insertOverlayAfter;
586586
if (insertOverlayAfter) {
587-
const rect = insertOverlayAfter!.nativeElement.getBoundingClientRect();
587+
const rect = insertOverlayAfter!.nativeElement.parentElement.getBoundingClientRect();
588588
overlayStartX -= rect.left;
589589
overlayStartY -= rect.top;
590590
}
@@ -909,6 +909,14 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
909909
const maxHeight = this._overlayRef.getConfig().maxHeight;
910910
const maxWidth = this._overlayRef.getConfig().maxWidth;
911911

912+
// Adjust the overly position when it is placed inline relative to its parent.
913+
const insertOverlayAfter = this._overlayRef.getConfig().insertOverlayAfter;
914+
if (insertOverlayAfter) {
915+
const rect = insertOverlayAfter!.nativeElement.parentElement.getBoundingClientRect();
916+
boundingBoxRect.left -= rect.left;
917+
boundingBoxRect.top -= rect.top;
918+
}
919+
912920
styles.height = coerceCssPixelValue(boundingBoxRect.height);
913921
styles.top = coerceCssPixelValue(boundingBoxRect.top);
914922
styles.bottom = coerceCssPixelValue(boundingBoxRect.bottom);

0 commit comments

Comments
 (0)