winforms icon indicating copy to clipboard operation
winforms copied to clipboard

[Accessibility][Win11] The color contrast of the dataGridViewCheckBox cell is less than 3:1

Open IDEExperienceTestSolution opened this issue 3 years ago • 6 comments

.NET Core Version:

  • .NET SDK 7.0.100-preview.2.22108.9

Have you experienced this same bug with .NET Framework?:

  • Yes

More Info:

  1. This issue can’t reproduce on Windows 10 OS.
  2. This issue can reproduce on Windows 11 OS both for Winforms NetFX and Core projects(can reproduce with 3.1, 5.0, 6.0, 7.0).

Problem description: The color contrast less than 3:1 between background color of checkbox and background color of whole cell. For Win11: image

Expected behavior: The color contrast should be greater than 3:1 between background color of checkbox and background color of whole cell. For Win10: image

Minimal repro:

  1. Create a .NET Core Winforms application with DataGridView control added.
  2. Add a DataGridViewTextBoxColumn to it.
  3. Build and run the project.
  4. Check the checkbox, then launch Accessibility Insights for windows tool and observe the color contrast. Or download the attached project, then execute above step 4. CheckBoxCellColorContrast.zip

How about adjusting the fill color to meet the contrast ratio?

merriemcgaw avatar Feb 17 '22 23:02 merriemcgaw

You can manually override the default colors to meet the contrast requirements. But visually impaired users will typically use something like a high contrast theme in Windows. Overriding the 'default' colors with specific ones, will break this.

tinodo avatar May 12 '22 06:05 tinodo

Style in Win11 depends on native style which you can see below on a screen of the MFC app: image

I can add a black border (only for Win11) to highlight selected checkboxes. It looks like this on the screen: image image

@merriemcgaw is it an appropriate way?

NikitaSemenovAkvelon avatar Aug 01 '22 09:08 NikitaSemenovAkvelon

@NikitaSemenovAkvelon I would also check to see how it looks on Win 11 in the new high contrast themes as @tinodo mentioned above. It needs to look good on all the different contrast views as well as normal view.

@Olina-Zhang I just noticed the changes in Win11 high contrast themes, it might be worth taking a look at all of our regular controls and verifying them in the new themes. I hope that some of the colors we may have hard coded don't wind up looking ridiculous. If they do look bad, we'll need to figure out a more holistic solution, so please do file an issue with the list of controls that violate the guidelines or just look plain awful 😺. That would be .NET 8 work for sure.

merriemcgaw avatar Aug 04 '22 01:08 merriemcgaw

With any of the contrast themes, checkboxes have contrast colors. So, if a user uses a contrast theme, he won't have any trouble. image image image image image

NikitaSemenovAkvelon avatar Aug 04 '22 05:08 NikitaSemenovAkvelon

@NikitaSemenovAkvelon in that case I think you can go with your approach.

merriemcgaw avatar Aug 09 '22 19:08 merriemcgaw

@dmitrii-drobotov - a reliable and future-proof fix for this issue required UXTHeme team opening up some APIs for us. Putting this bug on hold until that happens,

Tanya-Solyanik avatar Feb 24 '23 19:02 Tanya-Solyanik

@merriemcgaw - should we close this issue as external?

Tanya-Solyanik avatar Jul 13 '23 20:07 Tanya-Solyanik

I think for now we should. @KlausLoeffelmann and I are tackling getting some APIs opened on a separate track. If that opens up, we'll be able to do a lot of things.

merriemcgaw avatar Jul 14 '23 19:07 merriemcgaw