Skip to content

Commit e2999a8

Browse files
crisbetojelbourn
authored andcommitted
fix(overlay): transparent overlay not blocking scroll on Firefox 57 (#9446)
As of Firefox 57, it looks like elements with a transparent background won't capture scroll events. These changes work around the issue by not setting the background color, but using `opacity` to hide the element while keeping it scrollable. Fixes #8924.
1 parent 7cea0b6 commit e2999a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cdk/overlay/_overlay.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
7373
}
7474

7575
.cdk-overlay-transparent-backdrop {
76-
background: none;
76+
// Note: as of Firefox 57, having the backdrop be `background: none` will prevent it from
77+
// capturing the user's mouse scroll events. Since we also can't use something like
78+
// `rgba(0, 0, 0, 0)`, we work around the inconsistency by not setting the background at
79+
// all and using `opacity` to make the element transparent.
80+
&, &.cdk-overlay-backdrop-showing {
81+
opacity: 0;
82+
}
7783
}
7884

7985
// Used when disabling global scrolling.

0 commit comments

Comments
 (0)