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(material-experimental/mdc-list): add high contrast mode treatment #21376

Merged
merged 1 commit into from
Apr 2, 2021
Merged
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
33 changes: 33 additions & 0 deletions src/material-experimental/mdc-list/list.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use '@material/list' as mdc-list;
@use '../mdc-helpers/mdc-helpers';
@use '../../material/core/style/layout-common';
@use '../../cdk/a11y/a11y';

@include mdc-list.deprecated-without-ripple($query: mdc-helpers.$mat-base-styles-query);

Expand Down Expand Up @@ -124,3 +125,35 @@
@include layout-common.fill();
pointer-events: none;
}


@include a11y.high-contrast(active, off) {
.mat-mdc-list-option,
.mat-mdc-nav-list .mat-mdc-list-item,
.mat-mdc-action-list .mat-mdc-list-item {
&:hover, &:focus {
outline: dotted 1px;
}
}

// In single selection mode, the selected option is indicated by changing its
// background color, but that doesn't work in high contrast mode. We add an
// alternate indication by rendering out a circle.
.mat-mdc-list-option.mdc-list-item--selected::after {
$size: 10px;
content: '';
position: absolute;
top: 50%;
right: mdc-list.$deprecated-side-padding;
transform: translateY(-50%);
width: $size;
height: 0;
border-bottom: solid $size;
border-radius: $size;
}

[dir='rtl'] .mat-mdc-list-option.mdc-list-item--selected::after {
right: auto;
left: mdc-list.$deprecated-side-padding;
}
}