Product: axe-core
Expectation: When calculating contrast ratio for an element in closed <details>, either:
- take background color of open
<details> element (might not be possible without page interaction, which could be a roadblock),
- or don't take any background color at all, effectively skipping the color-contrast test for this element.
- or if we really really would like to take background color of where the element would have been if the
<details> element was open, ignore <details>'s siblings when calculating background colors, because they will be pushed down when <details> is eventually opened.
Actual: background color is taken from the place where the element would have been if the <details> element was open. Unfortunately, in our example, in this place we have a dark blue button which, when combined with black text, fails the test.
Motivation: Current behavior is obviously faulty.
axe-core version: checked on: 4.0.0, …, 4.1.0, …, 4.2.0, …, 4.3.0, …, 4.4.0, …, 4.4.2
Browser and Assistive Technology versions
Chrome 103.0.5060.53
Repro:
<html lang="en-US">
<head>
<style>
span {
position: relative;
}
button {
background-color: darkblue;
color: #fff;
}
</style>
<title>color-contrast bug</title>
</head>
<body>
<header>
<h1>color-contrast bug</h1>
</header>
<main>
<details>
<summary>Summary</summary>
<span>Some text</span>
</details>
<button>A blue button</button>
</main>
</body>
</html>
Product: axe-core
Expectation: When calculating contrast ratio for an element in closed
<details>, either:<details>element (might not be possible without page interaction, which could be a roadblock),<details>element was open, ignore<details>'s siblings when calculating background colors, because they will be pushed down when<details>is eventually opened.Actual: background color is taken from the place where the element would have been if the
<details>element was open. Unfortunately, in our example, in this place we have a dark blue button which, when combined with black text, fails the test.Motivation: Current behavior is obviously faulty.
Repro: