File tree 5 files changed +56
-27
lines changed
5 files changed +56
-27
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ export class ListDemo {
53
53
] ;
54
54
55
55
links : { name : string ; href : string } [ ] = [
56
- { name : 'Inbox' , href : '/mdc- list#inbox' } ,
57
- { name : 'Outbox' , href : '/mdc- list#outbox' } ,
58
- { name : 'Spam' , href : '/mdc- list#spam' } ,
59
- { name : 'Trash' , href : '/mdc- list#trash' } ,
56
+ { name : 'Inbox' , href : '/list#inbox' } ,
57
+ { name : 'Outbox' , href : '/list#outbox' } ,
58
+ { name : 'Spam' , href : '/list#spam' } ,
59
+ { name : 'Trash' , href : '/list#trash' } ,
60
60
] ;
61
61
62
62
thirdLine = false ;
Original file line number Diff line number Diff line change @@ -36,10 +36,19 @@ ng_module(
36
36
],
37
37
)
38
38
39
+ sass_library (
40
+ name = "hcm_indicator_scss_lib" ,
41
+ srcs = ["_list-item-hcm-indicator.scss" ],
42
+ deps = [
43
+ "//:mdc_sass_lib" ,
44
+ ],
45
+ )
46
+
39
47
sass_library (
40
48
name = "list_scss_lib" ,
41
49
srcs = glob (["**/_*.scss" ]),
42
50
deps = [
51
+ ":hcm_indicator_scss_lib" ,
43
52
"//:mdc_sass_lib" ,
44
53
"//src/material/checkbox:checkbox_scss_lib" ,
45
54
"//src/material/core:core_scss_lib" ,
@@ -50,6 +59,7 @@ sass_binary(
50
59
name = "list_scss" ,
51
60
src = "list.scss" ,
52
61
deps = [
62
+ ":hcm_indicator_scss_lib" ,
53
63
"//:mdc_sass_lib" ,
54
64
"//src/material/core:core_scss_lib" ,
55
65
],
Original file line number Diff line number Diff line change
1
+ @use ' @angular/cdk' ;
2
+ @use ' @material/list/evolution-variables' as mdc-list-variables ;
3
+
4
+ // Renders a circle indicator when Windows Hich Constrast mode (HCM) is enabled. In some
5
+ // situations, such as a selected option, the list item communicates the selected state by changing
6
+ // its background color. Since that doesn't work in HCM, this mixin provides an alternative by
7
+ // rendering a circle.
8
+ @mixin private-high-contrast-list-item-indicator () {
9
+ @include cdk .high-contrast (active , off) {
10
+ & ::after {
11
+ $size : 10px ;
12
+ content : ' ' ;
13
+ position : absolute ;
14
+ top : 50% ;
15
+ right : mdc-list-variables .$side-padding ;
16
+ transform : translateY (-50% );
17
+ width : $size ;
18
+ height : 0 ;
19
+ border-bottom : solid $size ;
20
+ border-radius : $size ;
21
+ }
22
+
23
+ [dir = ' rtl' ] {
24
+ & ::after {
25
+ right : auto ;
26
+ left : mdc-list-variables .$side-padding ;
27
+ }
28
+ }
29
+ }
30
+ }
Original file line number Diff line number Diff line change 1
1
@use ' sass:map' ;
2
- @use ' @angular/cdk' ;
3
2
@use ' @material/checkbox/checkbox' as mdc-checkbox ;
4
- @use ' @material/list/evolution-variables' as mdc-list-variables ;
5
3
@use ' @material/checkbox/checkbox-theme' as mdc-checkbox-theme ;
6
4
7
5
@use ' ../core/mdc-helpers/mdc-helpers' ;
8
6
@use ' ../checkbox/checkbox-private' ;
9
7
@use ' ./list-option-trailing-avatar-compat' ;
8
+ @use ' ./list-item-hcm-indicator' ;
10
9
11
10
// For compatibility with the non-MDC list, we support avatars that are shown at the end
12
11
// of the list option. We create a class similar to MDC's `--trailing-icon` one.
53
52
}
54
53
}
55
54
56
- @include cdk .high-contrast (active , off) {
57
- // In single selection mode, the selected option is indicated by changing its
58
- // background color, but that doesn't work in high contrast mode. We add an
59
- // alternate indication by rendering out a circle.
60
- .mat-mdc-list-option.mdc-list-item--selected ::after {
61
- $size : 10px ;
62
- content : ' ' ;
63
- position : absolute ;
64
- top : 50% ;
65
- right : mdc-list-variables .$side-padding ;
66
- transform : translateY (-50% );
67
- width : $size ;
68
- height : 0 ;
69
- border-bottom : solid $size ;
70
- border-radius : $size ;
71
- }
72
-
73
- [dir = ' rtl' ] .mat-mdc-list-option.mdc-list-item--selected ::after {
74
- right : auto ;
75
- left : mdc-list-variables .$side-padding ;
76
- }
55
+ .mat-mdc-list-option.mdc-list-item--selected {
56
+ // Improve accessibility for Window High Contrast Mode (HCM) by adding an idicator on the selected
57
+ // option.
58
+ @include list-item-hcm-indicator .private-high-contrast-list-item-indicator ();
77
59
}
Original file line number Diff line number Diff line change 1
1
@use ' @material/list/evolution-mixins' as mdc-list ;
2
2
@use ' ../core/style/layout-common' ;
3
3
@use ' ../core/mdc-helpers/mdc-helpers' ;
4
+ @use ' ./list-item-hcm-indicator' ;
4
5
5
6
@include mdc-helpers .disable-mdc-fallback-declarations {
6
7
@include mdc-list .without-ripple ($query : mdc-helpers .$mdc-base-styles-query );
7
8
}
8
9
10
+ a .mdc-list-item--activated {
11
+ // Improve accessibility for Window High Contrast Mode (HCM) by adding an idicator on active
12
+ // links.
13
+ @include list-item-hcm-indicator .private-high-contrast-list-item-indicator ();
14
+ }
15
+
9
16
// MDC expects the list element to be a `<ul>`, since we use `<mat-list>` instead we need to
10
17
// explicitly set `display: block`
11
18
.mat-mdc-list-base {
You can’t perform that action at this time.
0 commit comments