Skip to content

Commit df97d1a

Browse files
committed
fix(material-experimental/mdc-slider): not usable in high contrast mode
Fixes the MDC slider track not being visible in high contrast mode and the thumb label just floating on top of the slider.
1 parent 7f6972f commit df97d1a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/material-experimental/mdc-slider/slider.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import '@material/slider/mixins';
22
@import '../mdc-helpers/mdc-helpers';
3+
@import '../../cdk/a11y/a11y';
34

45
$mat-slider-min-size: 128px !default;
56
$mat-slider-horizontal-margin: 8px !default;
@@ -24,6 +25,21 @@ $mat-slider-horizontal-margin: 8px !default;
2425
// the slider to automatically expand horizontally for backwards compatibility.
2526
width: auto;
2627
min-width: $mat-slider-min-size - (2 * $mat-slider-horizontal-margin);
28+
29+
@include cdk-high-contrast {
30+
// The slider track isn't visible in high contrast mode so we work
31+
// around it by setting an outline and removing the height to make it look solid.
32+
.mdc-slider__track-container {
33+
height: 0;
34+
outline: solid 2px;
35+
margin-top: 1px;
36+
}
37+
38+
// Adds an outline around the thumb label so it doesn't just float on top of the slider.
39+
.mdc-slider__pin-value-marker {
40+
outline: solid 1px;
41+
}
42+
}
2743
}
2844

2945
// In order to make it possible for developers to disable animations for a slider,

0 commit comments

Comments
 (0)