File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
@import ' ../core/style/elevation' ;
2
2
@import ' ../core/style/vendor-prefixes' ;
3
3
@import ' ../core/style/layout-common' ;
4
+ @import ' ../../cdk/a11y/a11y' ;
4
5
5
6
$mat-button-toggle-padding : 0 16px !default ;
6
7
$mat-button-toggle-height : 36px !default ;
@@ -18,6 +19,10 @@ $mat-button-toggle-border-radius: 2px !default;
18
19
cursor : pointer ;
19
20
white-space : nowrap ;
20
21
overflow : hidden ;
22
+
23
+ @include cdk-high-contrast {
24
+ outline : solid 1px ;
25
+ }
21
26
}
22
27
23
28
.mat-button-toggle-vertical {
@@ -45,6 +50,11 @@ $mat-button-toggle-border-radius: 2px !default;
45
50
& .cdk-keyboard-focused {
46
51
.mat-button-toggle-focus-overlay {
47
52
opacity : 1 ;
53
+
54
+ // In high contrast mode `opacity: 1` will show the overlay as solid so we fall back 0.5.
55
+ @include cdk-high-contrast {
56
+ opacity : 0.5 ;
57
+ }
48
58
}
49
59
}
50
60
}
@@ -69,6 +79,17 @@ $mat-button-toggle-border-radius: 2px !default;
69
79
pointer-events : none ;
70
80
opacity : 0 ;
71
81
@include mat-fill ;
82
+
83
+ .mat-button-toggle-checked & {
84
+ // Changing the background color for the selected item won't be visible in high contrast mode.
85
+ // We fall back to using the overlay to draw a brighter, semi-transparent tint on top instead.
86
+ // It uses a border, because the browser will render it using a brighter color.
87
+ @include cdk-high-contrast {
88
+ opacity : 0.5 ;
89
+ height : 0 ;
90
+ border-bottom : solid $mat-button-toggle-height ;
91
+ }
92
+ }
72
93
}
73
94
74
95
.mat-button-toggle-ripple {
You can’t perform that action at this time.
0 commit comments