Skip to content

Commit b989701

Browse files
crisbetommalerba
authored andcommitted
fix(material-experimental/mdc-slide-toggle): fix extra border… (#18035)
In the latest MDC Canary version an extra border was added to the slide toggle. The border also gets set to `transparent`, but due to insertion order gets overwritten by the base shorthand `border` declaration. This was only an issue for the `primary` color, because we were assuming that it's the default so we included less specific styles. These changes make it the same specificity as the other colors. Also bumps us to the latest MDC Canary version.
1 parent 4dd0873 commit b989701

File tree

4 files changed

+516
-508
lines changed

4 files changed

+516
-508
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@types/youtube": "^0.0.38",
5454
"@webcomponents/custom-elements": "^1.1.0",
5555
"core-js": "^2.6.9",
56-
"material-components-web": "5.0.0-canary.50f110a6c.0",
56+
"material-components-web": "5.0.0-canary.c6808c51c.0",
5757
"rxjs": "^6.5.3",
5858
"systemjs": "0.19.43",
5959
"tslib": "^1.10.0",

src/material-experimental/mdc-slide-toggle/_mdc-slide-toggle.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
@include mat-using-mdc-theme($theme) {
1818
$mdc-switch-baseline-theme-color: primary !global;
1919

20-
@include mdc-switch-without-ripple($query: $mat-theme-styles-query);
2120
@include mdc-form-field-core-styles($query: $mat-theme-styles-query);
2221

2322
// MDC's switch doesn't support a `color` property. We add support
@@ -27,6 +26,10 @@
2726
background: $mdc-switch-toggled-off-ripple-color;
2827
}
2928

29+
&.mat-primary {
30+
@include mdc-switch-without-ripple($query: $mat-theme-styles-query);
31+
}
32+
3033
&.mat-accent {
3134
$mdc-switch-baseline-theme-color: secondary !global;
3235
@include mdc-switch-without-ripple($query: $mat-theme-styles-query);

src/material-experimental/mdc-slide-toggle/slide-toggle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export class MatSlideToggleChange {
6868
'[attr.tabindex]': 'null',
6969
'[attr.aria-label]': 'null',
7070
'[attr.aria-labelledby]': 'null',
71-
'[class.mat-primary]': 'color == "primary"',
72-
'[class.mat-accent]': 'color == "accent"',
73-
'[class.mat-warn]': 'color == "warn"',
71+
'[class.mat-primary]': 'color === "primary"',
72+
'[class.mat-accent]': 'color !== "primary" && color !== "warn"',
73+
'[class.mat-warn]': 'color === "warn"',
7474
'[class.mat-mdc-slide-toggle-focused]': '_focused',
7575
'[class.mat-mdc-slide-toggle-checked]': 'checked',
7676
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',

0 commit comments

Comments
 (0)