components icon indicating copy to clipboard operation
components copied to clipboard

No background-color css in mat-select-panel

Open Abdullah-FAl opened this issue 7 years ago • 9 comments

What is the expected behavior?

https://material.angular.io/components/select/overview

What is the current behavior?

No background-color css in class .mat-select-panel

image «««««

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://stackblitz.com/angular/nqgbrbknjje

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

Angular 7.1.3 material 7.1.1 typescript 3.1.6

Abdullah-FAl avatar Dec 17 '18 13:12 Abdullah-FAl

My guess is that either something isn't correctly or you've got some of your own styles overriding the panel's background. Are you sure that your theme CSS isn't included inside of a component with view encapsulation?

crisbeto avatar Dec 17 '18 14:12 crisbeto

yes i am sure theme CSS isn't included inside of a component with view !

I have a normal component And added a mat-select component to it form material.angular.io

Abdullah-FAl avatar Dec 18 '18 07:12 Abdullah-FAl

Some styles appear and some do not appear in mat-select component

Abdullah-FAl avatar Dec 18 '18 07:12 Abdullah-FAl

@Abdullah-FAl can you share a reproduction?

jelbourn avatar Dec 22 '18 00:12 jelbourn

I reproduced the same issue with:

"@angular/cdk": "~7.2.0", "@angular/material": "^7.2.0",

inside Mat Table Paginator items per page select.

I am not using prebuilt theme, I have created my own:

$app-primary: mat-palette($mat-red); $app-accent: mat-palette($mat-indigo, A200, A100, A400); $app-warn: mat-palette($mat-amber, 400); $app-dark-theme: mat-dark-theme( $app-primary, $app-accent, $app-warn );

and wrapped it inside a class as per docs

.theme__dark { @include angular-material-theme($app-dark-theme) }

this class is set in app.component.ts <div class="theme-dark"><router-outlet></router-outlet></div>

Inside this router outlet obviously is the Mat Table Component :) with the problem...

I managed to solve the problem with ::ng-deep .mat-select-panel { background: white; } but I have lost ripple and hover effects...

Other components on the page( mat-cards, table itself...) don't have before-mentioned problem, only mat-select component

rskendzic avatar Jan 04 '19 12:01 rskendzic

@rskendzic I tried out your theme config against our dev app and it seems to work:

angular_material_-_google_chrome_2019-01-04_15-08-06

crisbeto avatar Jan 04 '19 13:01 crisbeto

Hello! @jelbourn and @crisbeto @rskendzic Sorry for the late reply ! after some debugging I solved the problem! It was @import ~ @ angular / material / theming More than once and I was cause of the problem! You can view my #commit to this Test Project

Providing a StackBlitz reproduction !

StackBlitz starter: StackBlitz my-Angular-Material-project

Abdullah-FAl avatar Jan 06 '19 12:01 Abdullah-FAl

@crisbeto Yeah my bad.

Since certain components (e.g. menu, select, dialog, etc.) are inside of a global overlay container, an additional step is required for those components to be affected by the theme's css class selector (.unicorn-dark-theme in the example above).

Missed this part of the code.

rskendzic avatar Jan 08 '19 08:01 rskendzic

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.