Skip to content

Commit

Permalink
fix(material/slide-toggle): no outline when selected in high contrast…
Browse files Browse the repository at this point in the history
… mode (#28979)

Fixes that the M3 slide toggle didn't have an outline when it's selected in high contrast mode.
  • Loading branch information
crisbeto committed Apr 30, 2024
1 parent 58fa9b7 commit dde3793
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/material/core/tokens/m2/mat/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $prefix: (mat, switch);
track-outline-width: 1px,
track-outline-color: transparent,
selected-track-outline-width: 1px,
selected-track-outline-color: transparent,
disabled-unselected-track-outline-width: 1px,
disabled-unselected-track-outline-color: transparent,
);
Expand Down
3 changes: 2 additions & 1 deletion src/material/core/tokens/m3/mat/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ $prefix: (mat, switch);
hidden-track-transition: token-utils.hardcode(opacity 75ms, $exclude-hardcoded),
track-outline-width: token-utils.hardcode(2px, $exclude-hardcoded),
track-outline-color: map.get($systems, md-sys-color, outline),
selected-track-outline-width: token-utils.hardcode(0, $exclude-hardcoded),
selected-track-outline-width: token-utils.hardcode(2px, $exclude-hardcoded),
selected-track-outline-color: token-utils.hardcode(transparent, $exclude-hardcoded),
disabled-unselected-track-outline-width: token-utils.hardcode(2px, $exclude-hardcoded),
disabled-unselected-track-outline-color: map.get($systems, md-sys-color, on-surface),
);
Expand Down
1 change: 1 addition & 0 deletions src/material/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
.mdc-switch--selected .mdc-switch__track::after,
.mdc-switch--selected .mdc-switch__track::before {
@include token-utils.create-token-slot(border-width, selected-track-outline-width);
@include token-utils.create-token-slot(border-color, selected-track-outline-color);
}

.mdc-switch--disabled .mdc-switch__track::after,
Expand Down

0 comments on commit dde3793

Please sign in to comment.