Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(list): add hover and focus indication in high contrast mode #14637

Merged
merged 1 commit into from
Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the a11y dependency to the bazel build file?

It currently just depends on the a11y sass_library transitively being available in the Bazel deps

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"
  ],
)

I already walked through all build files and enforced this manually, but there is no real enforcement check yet.



$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