dotnet / dotnet/wpf

Border contrast failures in High Contrast White

Open
#3,610 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Core Version: 3.1.402
* Windows version: 10H2 19042.508
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No
* Security issues and bugs should be reported privately, learn more via our [responsible disclosure guidelines](https://github.com/dotnet/wpf/blob/master/README.md#reporting-security-issues-and-security-bugs).



**Problem description:**
As called out in Section 1.4.11 of https://www.w3.org/TR/WCAG21/, adjacent colors of non-text elements need to have a minimum contrast of 3.0. WPF satisfies this requirement in all modes except High Contrast White, where the gradient brush used for control borders goes from Black (0, 0, 0). to a gray (192, 192, 192). The contrast of the gray to the white background (255, 255, 255) is about 1.82, which fails the requirement. Here's a screenshot showing the failures in High Contrast White mode--it's intentionally zoomed to make it easier to see the contrast issue on the bottom and right sides of the controls, some of which are highlighted with red arrows:

![image](https://user-images.githubusercontent.com/45672944/95115949-24ddb680-06fb-11eb-9bf6-5531e19f7c52.png)

This pattern occurs with radiobuttons, textboxes, checkboxes, and comboboxes, and probably other control types.

The simplest fix here is to draw the borders with a solid black brush--in the Black-based High Contrast modes, the borders are drawn with a solid white brush, and they work just fine.

I'm aware that it's possible to style the control borders, but the default behavior of the framework should comply with the basic contrast requirements.

**Actual behavior:**

**Expected behavior:**

**Minimal repro:**
[WpfTest.zip](https://github.com/dotnet/wpf/files/5329332/WpfTest.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.