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(
2020 ],
2121 ),
2222 assets = [
23+ ":button_high_contrast_scss" ,
2324 ":button_scss" ,
2425 ":fab_scss" ,
2526 ":icon-button_scss" ,
@@ -54,12 +55,18 @@ sass_binary(
5455 ],
5556 deps = [
5657 ":button_base_scss_lib" ,
57- "//src/cdk/a11y:a11y_scss_lib" ,
5858 "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
5959 "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
6060 ],
6161)
6262
63+ sass_binary (
64+ name = "button_high_contrast_scss" ,
65+ src = "button-high-contrast.scss" ,
66+ include_paths = ["external/npm/node_modules" ],
67+ deps = ["//src/cdk/a11y:a11y_scss_lib" ],
68+ )
69+
6370sass_binary (
6471 name = "fab_scss" ,
6572 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 11@use ' @material/button/button' as mdc-button ;
22@use ' @material/button/variables' as mdc-button-variables ;
33@use ' ../mdc-helpers/mdc-helpers' ;
4- @use ' ../../cdk/a11y' ;
54@use ' button-base' ;
65
76
4039 }
4140}
4241
43- // Add an outline to make buttons more visible in high contrast mode. Stroked buttons and FABs
44- // don't need a special look in high-contrast mode, because those already have an outline.
45- .mat-mdc-button :not (.mdc-button--outlined ),
46- .mat-mdc-unelevated-button :not (.mdc-button--outlined ),
47- .mat-mdc-raised-button :not (.mdc-button--outlined ),
48- .mat-mdc-outlined-button :not (.mdc-button--outlined ),
49- .mat-mdc-icon-button {
50- @include a11y .high-contrast (active , off) {
51- outline : solid 1px ;
52- }
53- }
54-
55- @include a11y .high-contrast (active , off) {
56- .mat-mdc-button-base :focus {
57- outline : solid 3px ;
58- }
59- }
60-
6142// Since the stroked button has has an actual border that reduces the available space for
6243// child elements such as the ripple container or focus overlay, an inherited border radius
6344// 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 {
4242 button[mat-stroked-button]
4343 ` ,
4444 templateUrl : 'button.html' ,
45- styleUrls : [ 'button.css' ] ,
45+ styleUrls : [ 'button.css' , 'button-high-contrast.css' ] ,
4646 inputs : MAT_BUTTON_INPUTS ,
4747 host : MAT_BUTTON_HOST ,
4848 exportAs : 'matButton' ,
@@ -73,7 +73,7 @@ export class MatButton extends MatButtonBase {
7373 host : MAT_ANCHOR_HOST ,
7474 inputs : MAT_ANCHOR_INPUTS ,
7575 templateUrl : 'button.html' ,
76- styleUrls : [ 'button.css' ] ,
76+ styleUrls : [ 'button.css' , 'button-high-contrast.css' ] ,
7777 encapsulation : ViewEncapsulation . None ,
7878 changeDetection : ChangeDetectionStrategy . OnPush ,
7979} )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import {
3535@Component ( {
3636 selector : `button[mat-icon-button]` ,
3737 templateUrl : 'button.html' ,
38- styleUrls : [ 'icon-button.css' ] ,
38+ styleUrls : [ 'icon-button.css' , 'button-high-contrast.css' ] ,
3939 inputs : MAT_BUTTON_INPUTS ,
4040 host : MAT_BUTTON_HOST ,
4141 exportAs : 'matButton' ,
@@ -61,7 +61,7 @@ export class MatIconButton extends MatButtonBase {
6161@Component ( {
6262 selector : `a[mat-icon-button]` ,
6363 templateUrl : 'button.html' ,
64- styleUrls : [ 'icon-button.css' ] ,
64+ styleUrls : [ 'icon-button.css' , 'button-high-contrast.css' ] ,
6565 inputs : MAT_ANCHOR_INPUTS ,
6666 host : MAT_ANCHOR_HOST ,
6767 exportAs : 'matButton, matAnchor' ,
You can’t perform that action at this time.
0 commit comments