Skip to content

fix(material/button-toggle): unable to override elevation and high contrast styling applied incorrectly #14722

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

Merged
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
6 changes: 4 additions & 2 deletions src/material/button-toggle/_button-toggle-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

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

.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/material/button-toggle/button-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,12 @@ $legacy-border-radius: 2px !default;
opacity: 0;
@include layout-common.fill;

.mat-button-toggle-checked & {
border-bottom: solid $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 a11y.high-contrast(active, off) {
// 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 a11y.high-contrast(active, off) {
.mat-button-toggle-checked & {
border-bottom: solid $legacy-height;
opacity: 0.5;
height: 0;
}
Expand Down