File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 2222 * Applies styles for users in high contrast mode. Note that this only applies
2323 * to Microsoft browsers. Chrome can be included by checking for the `html[hc]`
2424 * attribute, however Chrome handles high contrast differently.
25+ * @param target Which kind of high contrast setting to target. Defaults to `active`, can be
26+ * `white-on-black` or `black-on-white`.
2527 */
26- @mixin cdk-high-contrast {
27- @media screen and (-ms-high-contrast : active ) {
28+ @mixin cdk-high-contrast ( $target : active ) {
29+ @media screen and (-ms-high-contrast : $target ) {
2830 @content ;
2931 }
3032}
Original file line number Diff line number Diff line change 11@import ' ../core/theming/theming' ;
22@import ' ../core/typography/typography-utils' ;
3+ @import ' ../../cdk/a11y/a11y' ;
34
45
56@mixin mat-checkbox-theme ($theme ) {
2930 }
3031
3132 .mat-checkbox-checkmark-path {
32- // !important is needed here because a stroke must be set as an attribute on the SVG in order
33- // for line animation to work properly.
33+ // !important is needed here because a stroke must be set as an
34+ // attribute on the SVG in order for line animation to work properly.
3435 stroke : $checkbox-mark-color !important ;
36+
37+ @include cdk-high-contrast (black- on- white) {
38+ // Having the one above be !important ends up overriding the browser's automatic
39+ // color inversion so we need to re-invert it ourselves for black-on-white.
40+ stroke : #000 !important ;
41+ }
3542 }
3643
3744 .mat-checkbox-mixedmark {
6875 .mat-checkbox-label {
6976 color : $disabled-color ;
7077 }
78+
79+ @include cdk-high-contrast {
80+ opacity : 0.5 ;
81+ }
82+ }
83+
84+ // This one is moved down here so it can target both
85+ // the theme colors and the disabled state.
86+ @include cdk-high-contrast {
87+ .mat-checkbox-background {
88+ // Needs to be removed because it hides the checkbox outline.
89+ background : none ;
90+ }
7191 }
7292
7393 .mat-checkbox :not (.mat-checkbox-disabled ) {
Original file line number Diff line number Diff line change 44@import ' ../core/ripple/ripple' ;
55@import ' ../core/style/layout-common' ;
66@import ' ../core/style/noop-animation' ;
7+ @import ' ../../cdk/a11y/a11y' ;
78
89// Manual calculation done on SVG
910$_mat-checkbox-mark-path-length : 22.910259 ;
@@ -275,11 +276,18 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
275276}
276277
277278.mat-checkbox-mixedmark {
278- @extend %mat -checkbox-mark ;
279+ $height : floor ( $_mat -checkbox-mark-stroke-size ) ;
279280
280- height : floor ($_mat-checkbox-mark-stroke-size );
281+ @extend %mat-checkbox-mark ;
282+ height : $height ;
281283 opacity : 0 ;
282284 transform : scaleX (0 ) rotate (0deg );
285+
286+ @include cdk-high-contrast {
287+ height : 0 ;
288+ border-top : solid $height ;
289+ margin-top : $height ;
290+ }
283291}
284292
285293.mat-checkbox-label-before {
You can’t perform that action at this time.
0 commit comments