Skip to content

Commit d0bc91d

Browse files
crisbetotinayuangao
authored andcommitted
fix(overlay): hide overlay container when there are no attached overlays (#10139)
Hides the `.cdk-overlay-container` if it doesn't have any attached overlays. This prevents the browser from rendering it as a transparent overlay. Fixes #6882. Fixes #10033.
1 parent 35b66f9 commit d0bc91d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/cdk/overlay/_overlay.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
2929
.cdk-overlay-container {
3030
position: fixed;
3131
z-index: $cdk-z-index-overlay-container;
32+
33+
&:empty {
34+
// Hide the element when it doesn't have any child nodes. This doesn't
35+
// include overlays that have been detached, rather than disposed.
36+
display: none;
37+
}
3238
}
3339

3440
// We use an extra wrapper element in order to use make the overlay itself a flex item.

0 commit comments

Comments
 (0)