Update background color of selected List View item to meet contrast ratio requirement
See original GitHub issueDescribe the bug
Selected ListViewItems do not currently meet the 3:1 contrast ratio requirement relative to unselected items, as specified in MAS 1.4.11 - Non-text Contrast.
The selected color needs to be lighter in dark theme (currently it’s 2.2:1):
The selected color needs to be darker in light theme (currently it’s 1.8:1):
Additional context
Copied in part from an internal bug
Related to #1233
Proposed fix
https://github.com/microsoft/microsoft-ui-xaml/issues/2908#issuecomment-659632415
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (25 by maintainers)
Top Results From Across the Web
Change background color of selected item on a ListView
I want to know on how I can change the background color of the selected item on my listView. I only want to...
Read more >Understanding Success Criterion 1.4.3: Contrast (Minimum)
Providing a minimum luminance contrast ratio between the text and its background can make the text more readable even if the person does...
Read more >How to improve non-text contrast: color schemes and interface ...
When selecting colors, ensure there is at least a 3:1 contrast ratio between a color and its neighboring colors. If color is required...
Read more >Text elements must have sufficient color contrast against ...
Checks all text elements to ensure that the contrast between the foreground text and the background colors meet the WCAG 2 AA contrast...
Read more >background-color - CSS: Cascading Style Sheets | MDN
Color contrast ratio is determined by comparing the luminance of the text and background color values. In order to meet current Web Content ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would add the proposed brush like this then if nobody else is currently working on it:
@YuliKl As for the color contrast between selection rets and selection hover states in dark mode: Could we follow the color scheme used by the default button?
In our ListView case, that could for example look like this then:
We would use the following brushes here:
We would thus use your proposed brush for the the selection rest state and use the former brush used in the selected rest state (with opacity 0.6) now for the selected hover state. The brush used for the selected pressed state would remain unchanged. Effectively, we will have these opacity differences:
Would reusing the former selected rest brush with opacity 0.6 for the selected hover state be a valid 3:1 contrast ratio concern relative to unselected ListViewItems as well?
(The brushes used in Light mode and High-contrast mode would also remain unchanged as of now.)
I haven’t heard concerns and I think updating it would make sense.