diff --git a/src/dev-app/dialog/dialog-demo.ts b/src/dev-app/dialog/dialog-demo.ts index 0a49bba8ab63..9d91d0048b49 100644 --- a/src/dev-app/dialog/dialog-demo.ts +++ b/src/dev-app/dialog/dialog-demo.ts @@ -28,7 +28,7 @@ export class DialogDemo { disableClose: false, panelClass: 'custom-overlay-pane-class', hasBackdrop: true, - backdropClass: '', + backdropClass: defaultDialogConfig.backdropClass, width: '', height: '', minWidth: '', diff --git a/src/material/bottom-sheet/_bottom-sheet-theme.scss b/src/material/bottom-sheet/_bottom-sheet-theme.scss index 046e11d0b5f7..3c3139029c2e 100644 --- a/src/material/bottom-sheet/_bottom-sheet-theme.scss +++ b/src/material/bottom-sheet/_bottom-sheet-theme.scss @@ -5,12 +5,17 @@ @mixin mat-bottom-sheet-theme($theme) { $background: map-get($theme, background); $foreground: map-get($theme, foreground); + $backdrop-color: invert(mat-color($background, card, 0.288)); .mat-bottom-sheet-container { @include _mat-theme-elevation(16, $theme); background: mat-color($background, dialog); color: mat-color($foreground, text); } + + .mat-bottom-sheet-backdrop { + background: $backdrop-color; + } } @mixin mat-bottom-sheet-typography($config) { diff --git a/src/material/bottom-sheet/bottom-sheet-config.ts b/src/material/bottom-sheet/bottom-sheet-config.ts index 9bf09e225af7..6fa1938d913c 100644 --- a/src/material/bottom-sheet/bottom-sheet-config.ts +++ b/src/material/bottom-sheet/bottom-sheet-config.ts @@ -33,7 +33,7 @@ export class MatBottomSheetConfig { hasBackdrop?: boolean = true; /** Custom class for the backdrop. */ - backdropClass?: string; + backdropClass?: string = 'mat-bottom-sheet-backdrop'; /** Whether the user can use escape or clicking outside to close the bottom sheet. */ disableClose?: boolean = false; diff --git a/src/material/dialog/_dialog-theme.scss b/src/material/dialog/_dialog-theme.scss index c073788a4c48..afda210c3d6a 100644 --- a/src/material/dialog/_dialog-theme.scss +++ b/src/material/dialog/_dialog-theme.scss @@ -7,12 +7,17 @@ @mixin mat-dialog-theme($theme) { $background: map-get($theme, background); $foreground: map-get($theme, foreground); + $backdrop-color: invert(mat-color($background, card, 0.288)); .mat-dialog-container { @include _mat-theme-elevation(24, $theme); background: mat-color($background, dialog); color: mat-color($foreground, text); } + + .mat-dialog-backdrop { + background: $backdrop-color; + } } @mixin mat-dialog-typography($config) { diff --git a/src/material/dialog/dialog-config.ts b/src/material/dialog/dialog-config.ts index b99863d1ebb3..e7411d5a45e8 100644 --- a/src/material/dialog/dialog-config.ts +++ b/src/material/dialog/dialog-config.ts @@ -54,7 +54,7 @@ export class MatDialogConfig { hasBackdrop?: boolean = true; /** Custom class for the backdrop, */ - backdropClass?: string = ''; + backdropClass?: string = 'mat-dialog-backdrop'; /** Whether the user can use escape or clicking on the backdrop to close the modal. */ disableClose?: boolean = false; diff --git a/src/material/dialog/dialog.ts b/src/material/dialog/dialog.ts index baabadabcb7c..be490c9cb9e5 100644 --- a/src/material/dialog/dialog.ts +++ b/src/material/dialog/dialog.ts @@ -192,7 +192,7 @@ export class MatDialog implements OnDestroy { * @returns The overlay configuration. */ private _getOverlayConfig(dialogConfig: MatDialogConfig): OverlayConfig { - const state = new OverlayConfig({ + const overlayConfig = new OverlayConfig({ positionStrategy: this._overlay.position().global(), scrollStrategy: dialogConfig.scrollStrategy || this._scrollStrategy(), panelClass: dialogConfig.panelClass, @@ -206,10 +206,10 @@ export class MatDialog implements OnDestroy { }); if (dialogConfig.backdropClass) { - state.backdropClass = dialogConfig.backdropClass; + overlayConfig.backdropClass = dialogConfig.backdropClass; } - return state; + return overlayConfig; } /**