md-option.mat-selected does not support multiple themes
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Should be able to style the selected md-option
based on the currently selected theme
What is the current behavior?
Because the overlay for the select options are rendered outside of the Angular app
element, theme-specific styles cannot be applied to the selected option.
What are the steps to reproduce?
With the following Sass theme setup:
@import '~@angular/material/_theming.scss';
@include mat-core();
$default-theme: mat-dark-theme(mat-palette($mat-green), mat-palette($mat-red));
@include angular-material-theme($default-theme);
.red-app {
background-color: black;
$red-app-primary: mat-palette($mat-red);
$red-app-accent: mat-palette($mat-blue);
$red-dark: mat-dark-theme($red-app-primary, $red-app-accent);
@include angular-material-theme($red-dark);
}
.red-app .md-option.mat-selected.map-primary,
.red-app .mat-primary .mat-option.mat-selected {
color: map-get($mat-red, 400);
}
The styles relative to .mat-selected
will never be set because it is never rendered inside of an element containing the .red-app
theme class:
For sample implementation, see http://material-platform.azurewebsites.net/select
What is the use-case or motivation for changing an existing behavior?
md-option
should be able to be styled by the currently active theme.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Given the nature of the way the overlay for md-option
has been implemented, it would affect any version of Angular and TypeScript, as well as any OS and browser.
Material: 2.0.0-beta.7
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@JaimeStill overlay components require a little extra setup for multiple styles
https://github.com/angular/material2/blob/master/guides/theming.md#multiple-themes-and-overlay-based-components
Did you update the
themeClass
?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.