Skip to content

fix(material-experimental/mdc-slider): not usable in high contrast mode #17164

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 1 commit into from
Sep 27, 2019
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
1 change: 1 addition & 0 deletions src/material-experimental/mdc-slider/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sass_library(
name = "mdc_slider_scss_lib",
srcs = glob(["**/_*.scss"]),
deps = [
"//src/cdk/a11y:a11y_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
],
)
Expand Down
16 changes: 16 additions & 0 deletions src/material-experimental/mdc-slider/slider.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '@material/slider/mixins';
@import '../mdc-helpers/mdc-helpers';
@import '../../cdk/a11y/a11y';

$mat-slider-min-size: 128px !default;
$mat-slider-horizontal-margin: 8px !default;
Expand All @@ -24,6 +25,21 @@ $mat-slider-horizontal-margin: 8px !default;
// the slider to automatically expand horizontally for backwards compatibility.
width: auto;
min-width: $mat-slider-min-size - (2 * $mat-slider-horizontal-margin);

@include cdk-high-contrast {
// The slider track isn't visible in high contrast mode so we work
// around it by setting an outline and removing the height to make it look solid.
.mdc-slider__track-container {
height: 0;
outline: solid 2px;
margin-top: 1px;
}

// Adds an outline around the thumb label so it doesn't just float on top of the slider.
.mdc-slider__pin-value-marker {
outline: solid 1px;
}
}
}

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