Skip to content

Commit 76e8a38

Browse files
authored
fix(list): no selected indication in high contrast mode while… (#18585)
When a selection list is in single selection mode, it indicates which item is selected by changing its background color which is invisible in high contrast mode. These changes work around the issue by rendering out a circle next to the selected item. I went with the circle since it looks like a radio button which is what the list behaves as.
1 parent 2a6aae1 commit 76e8a38

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎src/material/list/list.scss‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,27 @@ mat-action-list {
325325
outline: dotted 1px;
326326
}
327327
}
328+
329+
// In single selection mode, the selected option is indicated by changing its
330+
// background color, but that doesn't work in high contrast mode. We add an
331+
// alternate indication by rendering out a circle.
332+
.mat-list-single-selected-option::after {
333+
$size: 10px;
334+
content: '';
335+
position: absolute;
336+
top: 50%;
337+
right: $mat-list-side-padding;
338+
transform: translateY(-50%);
339+
width: $size;
340+
height: 0;
341+
border-bottom: solid $size;
342+
border-radius: $size;
343+
}
344+
345+
[dir='rtl'] .mat-list-single-selected-option::after {
346+
right: auto;
347+
left: $mat-list-side-padding;
348+
}
328349
}
329350

330351

0 commit comments

Comments
 (0)