dequelabs / dequelabs/axe-core

Pseudo element on cousin not recognized as giving a background

Open
#4,534 0 comments 0 reactions 0 assignees View on GitHub
color contrast fix high rules support
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

Came across this gem of a false positive. A pseudo element on a previous sibling's child node was used to provide a background color:

```html

a[href] {
display: table;
margin: 1px 0px 9px;
}
.container {
display: table-cell;
vertical-align: middle;
}
.background {
width: 0px;
margin: 1px 0px 9px;
}
.background:before {
content: '';
background-color: #06c;
display: block;
height: 28px;
width: 140px;
}
.content {
line-height: 28px;
width: 140px;
text-align: center;
color: #eee;
}



Canadian Dollar


```

Axe-core currently looks at the element and the parent for pseudo elements. When we wrote that we knew it was an imperfect solution. To improve on this I wonder if we just need to find every pseudo element with a background and guestimate its position.

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.