File tree Expand file tree Collapse file tree 5 files changed +31
-24
lines changed
src/material-experimental/mdc-button Expand file tree Collapse file tree 5 files changed +31
-24
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ ng_module(
20
20
],
21
21
),
22
22
assets = [
23
+ ":button_high_contrast_scss" ,
23
24
":button_scss" ,
24
25
":fab_scss" ,
25
26
":icon-button_scss" ,
@@ -53,12 +54,18 @@ sass_binary(
53
54
],
54
55
deps = [
55
56
":button_base_scss_lib" ,
56
- "//src/cdk/a11y:a11y_scss_lib" ,
57
57
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
58
58
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
59
59
],
60
60
)
61
61
62
+ sass_binary (
63
+ name = "button_high_contrast_scss" ,
64
+ src = "button-high-contrast.scss" ,
65
+ include_paths = ["external/npm/node_modules" ],
66
+ deps = ["//src/cdk/a11y:a11y_scss_lib" ],
67
+ )
68
+
62
69
sass_binary (
63
70
name = "fab_scss" ,
64
71
src = "fab.scss" ,
Original file line number Diff line number Diff line change
1
+ @use ' ../../cdk/a11y' ;
2
+
3
+ // Add an outline to make buttons more visible in high contrast mode. Stroked buttons and FABs
4
+ // don't need a special look in high-contrast mode, because those already have an outline.
5
+ .mat-mdc-button :not (.mdc-button--outlined ),
6
+ .mat-mdc-unelevated-button :not (.mdc-button--outlined ),
7
+ .mat-mdc-raised-button :not (.mdc-button--outlined ),
8
+ .mat-mdc-outlined-button :not (.mdc-button--outlined ),
9
+ .mat-mdc-icon-button {
10
+ @include a11y .high-contrast (active , off) {
11
+ outline : solid 1px ;
12
+ }
13
+ }
14
+
15
+ @include a11y .high-contrast (active , off) {
16
+ .mat-mdc-button-base :focus {
17
+ outline : solid 3px ;
18
+ }
19
+ }
Original file line number Diff line number Diff line change 2
2
@use ' @material/button/variables' as mdc-button-variables ;
3
3
@use ' ../../material/core/style/private' ;
4
4
@use ' ../mdc-helpers/mdc-helpers' ;
5
- @use ' ../../cdk/a11y' ;
6
5
@use ' button-base' ;
7
6
8
7
42
41
}
43
42
}
44
43
45
- // Add an outline to make buttons more visible in high contrast mode. Stroked buttons and FABs
46
- // don't need a special look in high-contrast mode, because those already have an outline.
47
- .mat-mdc-button :not (.mdc-button--outlined ),
48
- .mat-mdc-unelevated-button :not (.mdc-button--outlined ),
49
- .mat-mdc-raised-button :not (.mdc-button--outlined ),
50
- .mat-mdc-outlined-button :not (.mdc-button--outlined ),
51
- .mat-mdc-icon-button {
52
- @include a11y .high-contrast (active , off) {
53
- outline : solid 1px ;
54
- }
55
- }
56
-
57
- @include a11y .high-contrast (active , off) {
58
- .mat-mdc-button-base :focus {
59
- outline : solid 3px ;
60
- }
61
- }
62
-
63
44
// Since the stroked button has has an actual border that reduces the available space for
64
45
// child elements such as the ripple container or focus overlay, an inherited border radius
65
46
// for the absolute-positioned child elements does not work properly. This is because the
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import {
42
42
button[mat-stroked-button]
43
43
` ,
44
44
templateUrl : 'button.html' ,
45
- styleUrls : [ 'button.css' ] ,
45
+ styleUrls : [ 'button.css' , 'button-high-contrast.css' ] ,
46
46
inputs : MAT_BUTTON_INPUTS ,
47
47
host : MAT_BUTTON_HOST ,
48
48
exportAs : 'matButton' ,
@@ -73,7 +73,7 @@ export class MatButton extends MatButtonBase {
73
73
host : MAT_ANCHOR_HOST ,
74
74
inputs : MAT_ANCHOR_INPUTS ,
75
75
templateUrl : 'button.html' ,
76
- styleUrls : [ 'button.css' ] ,
76
+ styleUrls : [ 'button.css' , 'button-high-contrast.css' ] ,
77
77
encapsulation : ViewEncapsulation . None ,
78
78
changeDetection : ChangeDetectionStrategy . OnPush ,
79
79
} )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import {
35
35
@Component ( {
36
36
selector : `button[mat-icon-button]` ,
37
37
templateUrl : 'button.html' ,
38
- styleUrls : [ 'icon-button.css' ] ,
38
+ styleUrls : [ 'icon-button.css' , 'button-high-contrast.css' ] ,
39
39
inputs : MAT_BUTTON_INPUTS ,
40
40
host : MAT_BUTTON_HOST ,
41
41
exportAs : 'matButton' ,
@@ -61,7 +61,7 @@ export class MatIconButton extends MatButtonBase {
61
61
@Component ( {
62
62
selector : `a[mat-icon-button]` ,
63
63
templateUrl : 'button.html' ,
64
- styleUrls : [ 'icon-button.css' ] ,
64
+ styleUrls : [ 'icon-button.css' , 'button-high-contrast.css' ] ,
65
65
inputs : MAT_ANCHOR_INPUTS ,
66
66
host : MAT_ANCHOR_HOST ,
67
67
exportAs : 'matButton, matAnchor' ,
You can’t perform that action at this time.
0 commit comments