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

Avoid duplicates between color-contrast and color-contrast-enhanced #3612

Closed
WilcoFiers opened this issue Aug 17, 2022 · 2 comments
Closed
Assignees
Labels
color contrast Color contrast issues performance Performance related issues pr A pr has been created for the issue rules Issue or false result from an axe-core rule
Milestone

Comments

@WilcoFiers
Copy link
Contributor

Product

axe-core

Feature Description

Currently the color-contrast-enhanced rule fails nodes that also fail the color-contrast rule. This creates duplicates when both rules are on. This isn't ideal. A better solution would be to pass nodes that are below the contrast threshold of color-contrast.

There are already options available in color-contrast-evaluate to do this. We should add caching to this evaluate method to avoid calculating the contrast of a node more than once though, since this is a fairly slow operation.

@WilcoFiers WilcoFiers added feat New feature or enhancement ungroomed Ticket needs a maintainer to prioritize and label rules Issue or false result from an axe-core rule color contrast Color contrast issues performance Performance related issues and removed feat New feature or enhancement ungroomed Ticket needs a maintainer to prioritize and label labels Aug 17, 2022
@WilcoFiers WilcoFiers added this to the Axe-core 4.5 milestone Aug 17, 2022
@WilcoFiers
Copy link
Contributor Author

Can probably memoize getBackgroundColor, that'll be the quickest way to cache this.

@padmavemulapati
Copy link

Validated with the latest develop branch code base,
when run both color-contrast-enhanced and color-contrast , now it is not resulting both incomplete results instead it is giving only color-contrast incomplete result and avoiding duplicate

Test snippet:

<p id="target" style="color: #666; background: linear-gradient(to right, #FFF, #0FF); width: 300px">
    Some text in English
  </p>
  <p id="target" style="color: #666; background: linear-gradient(to right, #FFF, #0FF); width: 300px; font-size: 18pt;">
    Some text in English
  </p>
  

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color contrast Color contrast issues performance Performance related issues pr A pr has been created for the issue rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

3 participants