Skip to content

Commit

Permalink
fix(list): add hover and focus indication in high contrast mode (angu…
Browse files Browse the repository at this point in the history
…lar#14637)

Fixes not being able to see which lists/list items are focused or hovered in high contrast mode.
  • Loading branch information
crisbeto authored and josephperrott committed Jan 14, 2019
1 parent b1376bb commit a156393
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/list/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sass_binary(
name = "list_scss",
src = "list.scss",
deps = [
"//src/cdk/a11y:a11y_scss_lib",
"//src/lib/core:core_scss_lib",
"//src/lib/divider:divider_scss_lib"
],
Expand Down
17 changes: 16 additions & 1 deletion src/lib/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import '../core/style/list-common';
@import '../core/style/layout-common';
@import '../divider/divider-offset';
@import '../../cdk/a11y/a11y';


$mat-list-side-padding: 16px;
Expand Down Expand Up @@ -269,7 +270,7 @@ $mat-list-item-inset-divider-offset: 72px;
}

mat-action-list {
//remove the native button look and make it look like a list item
// Remove the native button look and make it look like a list item
button {
background: none;
color: inherit;
Expand All @@ -289,6 +290,20 @@ mat-action-list {
outline: none;
}

@include cdk-high-contrast {
.mat-selection-list:focus {
outline-style: dotted;
}

.mat-list-option,
.mat-nav-list .mat-list-item,
mat-action-list .mat-list-item {
&:hover, &:focus {
outline: dotted 1px;
}
}
}


// Disable the hover styles on non-hover devices. Since this is more of a progressive
// enhancement and not all desktop browsers support this kind of media query, we can't
Expand Down

0 comments on commit a156393

Please sign in to comment.