Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pseudo element on cousin not recognized as giving a background #4534

Open
WilcoFiers opened this issue Jul 10, 2024 · 0 comments
Open

Pseudo element on cousin not recognized as giving a background #4534

WilcoFiers opened this issue Jul 10, 2024 · 0 comments
Labels
color contrast Color contrast issues fix Bug fixes rules Issue or false result from an axe-core rule support
Milestone

Comments

@WilcoFiers
Copy link
Contributor

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:

<style>
  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;
  }
</style>
<a href="#">
  <div class="container">
    <div class="background"></div>
  </div>
  <div class="content">Canadian Dollar</div>
</a>

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.

@WilcoFiers WilcoFiers added fix Bug fixes rules Issue or false result from an axe-core rule color contrast Color contrast issues support labels Jul 10, 2024
@WilcoFiers WilcoFiers added this to the Axe-core 4.11 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color contrast Color contrast issues fix Bug fixes rules Issue or false result from an axe-core rule support
Projects
None yet
Development

No branches or pull requests

1 participant