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 selected indication for options in high contrast mode #29707

Merged
merged 2 commits into from
Sep 10, 2024
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
4 changes: 2 additions & 2 deletions src/material/core/option/option.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ $_side-padding: 16px;
// 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.
&.mdc-list-item--selected:not(.mat-mdc-option-multiple)::after {
&.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after {
$size: 10px;
content: '';
position: absolute;
Expand All @@ -170,7 +170,7 @@ $_side-padding: 16px;
border-radius: $size;
}

[dir='rtl'] &.mdc-list-item--selected:not(.mat-mdc-option-multiple)::after {
[dir='rtl'] &.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after {
right: auto;
left: $_side-padding;
}
Expand Down
26 changes: 0 additions & 26 deletions src/material/list/_list-inherited-structure.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use '@angular/cdk';
@use '../core/style/vendor-prefixes';
@use '../core/tokens/m2/mdc/list' as tokens-mdc-list;
@use '../core/tokens/token-utils';
Expand Down Expand Up @@ -93,31 +92,6 @@
margin-top: 16px;
}
}

&.mdc-list-item--selected::before,
&.mdc-list-item--selected:focus::before,
&:not(.mdc-list-item--selected):focus::before {
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
top: 0;
left: 0;
border: 1px solid transparent;
border-radius: inherit;
content: '';
pointer-events: none;

@include cdk.high-contrast {
border-color: CanvasText;
}
}

&.mdc-list-item--selected:focus::before,
&.mdc-list-item--selected::before {
border-width: 3px;
border-style: double;
}
}

a.mdc-list-item {
Expand Down
3 changes: 3 additions & 0 deletions src/material/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ a.mdc-list-item--activated {
content: '';
opacity: 0;
pointer-events: none;

// This comes up in some internal implementations.
border-radius: inherit;
}

// The MDC-based list items already use the `::before` pseudo element for the standard
Expand Down
Loading