dequelabs / dequelabs/axe-core

Bug testing color-contrast when forced-colors active in v4.6

Open
#3,978 3 comments 1 reaction 0 assignees View on GitHub
color contrast fix
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

### Product

axe-core

### Product Version

v4.6

### Latest Version

- [X] I have tested the issue with the latest version of the product

### Issue Description

#### Expectation
When running color-contrast checks with `forced-colors` `active`, the colors used in the contrast calculation should be the colors presented with `forced-colors`.

#### Actual
The foreground color is calculated from the non-forced color and the background is calculated from the forced color.

#### How to Reproduce
I don't think one will be needed, but I can try to come up with one if needed.

#### Additional context
In [this commit](https://github.com/dequelabs/axe-core/commit/228daf153b3c6e45933a2ca8feac765f942663f4), get-foreground-color was changed to [use `-webkit-text-fill-color`](https://github.com/dequelabs/axe-core/blob/c051fe851fb5eaa75e6dc0205c4db5e75d80f3a4/lib/commons/color/get-foreground-color.js#L64) rather than `color`. This property is unchanged when `forced-colors` is `active`. [The background, however, is still using the `background-color` property](https://github.com/dequelabs/axe-core/blob/c051fe851fb5eaa75e6dc0205c4db5e75d80f3a4/lib/commons/color/get-own-background-color.js#L14) which *does* change when `forced-colors` is `active`.

This introduced a regression to my company's use of axe-core running `color-contrast` when `forced-colors` is `active` since it now uses a mix-and-match of forced and non-forced color values. I think it's probably unintended to mix-and-match, but I'm curious if axe-core even intends to support running `color-contrast` with `forced-colors` `active`.

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.