components icon indicating copy to clipboard operation
components copied to clipboard

Proposal: remove background-color from .mat-drawer-container

Open adamdport opened this issue 8 years ago • 12 comments

Bug, feature request, or proposal:

Proposal: remove background-color from .mat-drawer-container

What is the expected behavior?

The common background that I've set in my app appears on a page with a drawer

What is the current behavior?

Putting a drawer on a page requires putting the page contents inside md-drawer-container which comes with background-color set that overrides any app background that's been set.

What are the steps to reproduce?

Add a drawer to a page with a non-standard background

What is the use-case or motivation for changing an existing behavior?

Overlays for drawers and sliders are typically supposed to block the majority of the UI. IMHO material shouldn't be providing a background-color for this majority.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

2.0.0-beta.10

Is there anything else we should know?

adamdport avatar Oct 04 '17 19:10 adamdport

I agree with @adamdport I have to override this background color every time.

ja5onkendall avatar Oct 10 '17 01:10 ja5onkendall

You might as well add .color to that as well as it overrides both

rtaft avatar Apr 24 '18 18:04 rtaft

PLease do it.

DjStorm avatar Oct 27 '18 14:10 DjStorm

thats what is there currently , why ?

background-color: #fafafa;
color: rgba(0,0,0,.87);

wintersommer avatar Dec 14 '18 15:12 wintersommer

.mat-drawer-container{
background-color: #fafafa;
color: rgba(0,0,0,.87);
}

Its reflecting on my svgs and other elements too (in safari). It should be removed

hcurnor avatar Jan 09 '19 14:01 hcurnor

Agreed. For those wondering how to get rid of it, it seems you just have to set the background color of the mat-sidenav-container. This worked for me:

.mat-sidenav-container { background-color: #f2f2f2; }

jcanaan88 avatar Jan 23 '19 17:01 jcanaan88

This mat-drawer css is broken. It even overwrites my "routerLinkActive" color.

upondeep avatar Dec 13 '19 04:12 upondeep

A fix would be really appreciated. Normally you would like to have your theme applied to everything... If you overwrite the .mat-app-background like shown you can at least get the mat-app-background class to be more dominant than the the drawer container, but that is not as nice as I would like it...

$primary: mat-palette($primary-palette);
$accent: mat-palette($md-secondary);
$warn: mat-palette($warning-palette);
$light-theme: mat-light-theme($primary, $accent, $warn);

.dark-theme {
  $dark-primary: mat-palette($primary-palette, 200, 300, 400);
  $dark-accent: mat-palette($md-secondary-dark);
  $dark-warn: mat-palette($warning-palette);
  $dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);

  // Fix the theme not getting applied to slider
  .mat-app-background#{if(&, ', &.mat-app-background', '')} {
    $background: map-get($dark-theme, background);
    $foreground: map-get($dark-theme, foreground);

    background-color: mat-color($background, background) !important;
    color: mat-color($foreground, text) !important;
  }

  @include angular-material-theme($dark-theme);
}

HuiiBuh avatar Feb 21 '20 09:02 HuiiBuh

I asked this question on stackoverflow, maybe it can help..

<mat-drawer-container class="red-container">
...
</mat-drawer-container>

.red-container {
  background-color: red;
}

paco76 avatar Aug 07 '20 14:08 paco76

These seems like a trivial fix. Has there been any movement on this?

rickdgray avatar Apr 08 '23 01:04 rickdgray

This can cause very slight visual regressions in existing projects where background colors are just #FFF white, and makes it so that a first experience of implementing an Angular Material component requires a style FIX, as opposed to a style customization. Which in turn does not provide a good first experience, which is a bummer. Why is it there?

michahell avatar Jul 13 '23 09:07 michahell

This is still open right? Not the first time I end up in this issue. I would like to also suggest to add the possibility of setting the color of the drawer using the app theme e.j. (color="primary")

RamZal365 avatar Feb 27 '24 16:02 RamZal365