dequelabs / dequelabs/axe-core
Potential false positives with `font-variation-settings` and `color-contrast`
- Dominant language
- JavaScript
- Stars
- 7.5k
- Forks
- 933
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 17
Description
Product: axe-core `4.3.5`
Expectation: axe-core should not raise a false positive when setting [`font-variation-settings`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variation-settings)
Actual: A false positive is raised
Motivation: No false positives
The following CSS creates a `14 point` font with a `900 weight`:
```css
.font-variation-setting {
background-color: #fff;
color: #878787;
font-size: 14pt;
font-variation-settings: "wght" 900, "wdth" 200;
}
```
For 2 elements, one with and one without `font-variation-settings` looks like the following:

[Related Codepen](https://cdpn.io/scurker/debug/BadMPjd/PBkNWRozyDbM)
axe-core currently flags both as color contrast issues,
It appears `window.getComputedStyle(...).fontWeight` returns the font weight of the inherited `font-weight` value and not the one from `font-variation-settings`. Checking the value from `fontVariationSettings` in computed style would likely resolve this issue.
Contributor guide
Assessment
This issue has not been assessed yet.