Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(autocomplete,select): inconsistent disabled option coloring #6640

Merged
merged 1 commit into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/lib/autocomplete/_autocomplete-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
background: mat-color($background, card);
color: mat-color($foreground, text);

.mat-option {
// Selected options in autocompletes should not be gray, but we
// only want to override the background for selected options if
// they are *not* in hover or focus state. This change has to be
// made here because base option styles are shared between the
// autocomplete and the select.
&.mat-selected:not(.mat-active):not(:hover) {
background: mat-color($background, card);
// Selected options in autocompletes should not be gray, but we
// only want to override the background for selected options if
// they are *not* in hover or focus state. This change has to be
// made here because base option styles are shared between the
// autocomplete and the select.
.mat-option.mat-selected:not(.mat-active):not(:hover) {
background: mat-color($background, card);

&:not(.mat-option-disabled) {
color: mat-color($foreground, text);
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/lib/core/option/_option-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@
.mat-option {
color: mat-color($foreground, text);

&:hover:not(.mat-option-disabled), &:focus:not(.mat-option-disabled) {
&:hover:not(.mat-option-disabled),
&:focus:not(.mat-option-disabled) {
background: mat-color($background, hover);
}

.mat-primary &.mat-selected {
.mat-primary &.mat-selected:not(.mat-option-disabled) {
color: mat-color($primary);
}

.mat-accent &.mat-selected {
.mat-accent &.mat-selected:not(.mat-option-disabled) {
color: mat-color($accent);
}

.mat-warn &.mat-selected {
.mat-warn &.mat-selected:not(.mat-option-disabled) {
color: mat-color($warn);
}

// In multiple mode there is a checkbox to show that the option is selected.
&.mat-selected:not(.mat-option-multiple) {
&.mat-selected:not(.mat-option-multiple):not(.mat-option-disabled) {
background: mat-color($background, hover);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/option/option.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<span [ngSwitch]="_isCompatibilityMode" *ngIf="multiple">
<mat-pseudo-checkbox class="mat-option-pseudo-checkbox" *ngSwitchCase="true"
[state]="selected ? 'checked' : ''"></mat-pseudo-checkbox>
[state]="selected ? 'checked' : ''" [disabled]="disabled"></mat-pseudo-checkbox>
<md-pseudo-checkbox class="mat-option-pseudo-checkbox" *ngSwitchDefault
[state]="selected ? 'checked' : ''"></md-pseudo-checkbox>
[state]="selected ? 'checked' : ''" [disabled]="disabled"></md-pseudo-checkbox>
</span>

<ng-content></ng-content>
Expand Down