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

Contrast false positives returned by pa11y->axe #17

Open
geoffroy-noel-ddh opened this issue Jun 18, 2024 · 2 comments
Open

Contrast false positives returned by pa11y->axe #17

geoffroy-noel-ddh opened this issue Jun 18, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@geoffroy-noel-ddh
Copy link
Member

geoffroy-noel-ddh commented Jun 18, 2024

pa11y 6.2.3 returns too many false positive issues about contrast.

Example:

image

The reported text does pass AAA contrast requirements.

image

image

@geoffroy-noel-ddh geoffroy-noel-ddh added this to the 2024Q3 milestone Jun 18, 2024
@geoffroy-noel-ddh geoffroy-noel-ddh self-assigned this Jun 18, 2024
@geoffroy-noel-ddh geoffroy-noel-ddh added the bug Something isn't working label Jun 18, 2024
@geoffroy-noel-ddh
Copy link
Member Author

This is a known issue in Pa11y, which should be fixed in version 8. Pa11y doesn't distinguish warnings (due to uncertainty given the use of pseudo-classes) with actual errors from axe-core.

So, when ready, we should upgrade to latest version of Pa11y that fixes this.

Until then, we could ignore those specific contrast messages from axe-core when relayed by Pa11y. The hope is that contrast issues are correctly picked up by the other engine, html_codesniffer (CS) and are redundant anyway. So ensuring that this is the case and that CS suppresses Axe rather than the opposite could be a work-around.

@geoffroy-noel-ddh
Copy link
Member Author

Example of output below with correct detection of insufficient contrast by both engines.

node docs/evaluate.js thornton

            baseUri = 'https://design.homeoffice.gov.uk'
            webpath = '/accessibility/colour-and-contrast'
{
  documentTitle: 'Colour and contrast - Home Office Design System',
  pageUrl: 'https://design.homeoffice.gov.uk/accessibility/colour-and-contrast',
  issues: [
    {
      code: 'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail',
      type: 'error',
      typeCode: 1,
      message: 'This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 1.02:1. Recommendation:  change background to #000.',
      context: '<p style="color:yellow">Bad example text in yellow. Hav...</p>',
      selector: '#main-content > div > div:nth-child(2) > div:nth-child(27) > p',
      runner: 'htmlcs',
      runnerExtras: {}
    },
    {
      code: 'color-contrast',
      type: 'error',
      typeCode: 1,
      message: 'Elements must meet minimum color contrast ratio thresholds (https://dequeuniversity.com/rules/axe/4.8/color-contrast?application=axeAPI)',
      context: '<p style="color:yellow">Bad example text in yellow. Hav...</p>',
      selector: '#main-content > div > div:nth-child(2) > div:nth-child(27) > p',
      runner: 'axe',
      runnerExtras: [Object]
    }
  ]
}

geoffroy-noel-ddh added a commit that referenced this issue Jun 19, 2024
…d for now as they can be false positive. Axe does distinguish between error and warning (uncertainty). But Pa11y treat everything as errors. See #17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant