Skip to content

Commit

Permalink
fix(button-toggle): unable to override elevation and high contrast st…
Browse files Browse the repository at this point in the history
…yling applied incorrectly

* Fixes not being able to override the elevation of a button toggle. Similar to angular#7909, but makes avoids issues with the new appearance.
* Fixes some of the styles that are only intended to be applied in high contrast mode being active all the time. Seems like an issue while rebasing.

Fixes angular#14721.
  • Loading branch information
crisbeto committed Jan 4, 2019
1 parent 98711d7 commit e6ba9d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/lib/button-toggle/_button-toggle-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

.mat-button-toggle-standalone,
.mat-button-toggle-group {
@include _mat-theme-elevation(2, $theme);
@include _mat-theme-overridable-elevation(2, $theme);
}

.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
.mat-button-toggle-group-appearance-standard {
box-shadow: none;
&:not([class*='mat-elevation-z']) {
box-shadow: none;
}
}

.mat-button-toggle {
Expand Down
13 changes: 6 additions & 7 deletions src/lib/button-toggle/button-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ $mat-button-toggle-legacy-border-radius: 2px !default;
opacity: 0;
@include mat-fill;

.mat-button-toggle-checked & {
border-bottom: solid $mat-button-toggle-legacy-height;

// Changing the background color for the selected item won't be visible in high contrast mode.
// We fall back to using the overlay to draw a brighter, semi-transparent tint on top instead.
// It uses a border, because the browser will render it using a brighter color.
@include cdk-high-contrast {
// Changing the background color for the selected item won't be visible in high contrast mode.
// We fall back to using the overlay to draw a brighter, semi-transparent tint on top instead.
// It uses a border, because the browser will render it using a brighter color.
@include cdk-high-contrast {
.mat-button-toggle-checked & {
border-bottom: solid $mat-button-toggle-legacy-height;
opacity: 0.5;
height: 0;
}
Expand Down

0 comments on commit e6ba9d3

Please sign in to comment.