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

Help with Tag filtering #10

Open
jrtnq514 opened this issue Mar 15, 2018 · 7 comments
Open

Help with Tag filtering #10

jrtnq514 opened this issue Mar 15, 2018 · 7 comments
Assignees
Labels

Comments

@jrtnq514
Copy link

I'm trying to only show violations for the following tags: 'wcag2aa', 'wcag2a', 'section508'

gulp.js

const options = {
    a11yCheckOptions: {
      rules: {
        'html-has-lang': { enabled: false },
        bypass: { enabled: false },
        'image-alt': { enabled: false },
      },
    },
    verbose: true,
    showOnlyViolations: true,
    exclude: '.offleft, #flex-col, #flex-row',
    tags: ['wcag2aa', 'wcag2a', 'section508'],
    folderOutputReport: componentName === undefined ? 'tests/axe/allHtml' : 'tests/axe',
    saveOutputIn: componentName === undefined ? `a11y-html.json` : `a11y-${componentName}.json`,
    urls: componentName === undefined ? ['http://localhost:3000'] : [`http://localhost:3000/component/${componentName}/`],
  };

 axe(options, done);

However I'm still getting a violation with the best-practice tag.

results.json

"violations": [
      {
        "description": "Ensures a navigation point to the primary content of the page. If the page contains iframes, each iframe should contain either no main landmarks or just one.",
        "help": "Page must contain one main landmark.",
        "helpUrl": "https://dequeuniversity.com/rules/axe/2.6/landmark-one-main?application=webdriverjs",
        "id": "landmark-one-main",
        "impact": "moderate",
        "nodes": [
          {
            "all": [
              {
                "data": false,
                "id": "has-at-least-one-main",
                "impact": "moderate",
                "message": "Document has no main landmarks",
                "relatedNodes": []
              }
            ],
            "any": [],
            "html": "<html lang=\"en\">",
            "impact": "moderate",
            "none": [],
            "target": [
              "html"
            ]
          }
        ],
        "tags": [
          "best-practice"
        ]
      }
    ]

Anything I'm doing wrong or ideas of why this is happening?

Thanks

@felixzapata
Copy link
Owner

I will take a look ASAP.

@felixzapata felixzapata self-assigned this Mar 15, 2018
@felixzapata
Copy link
Owner

felixzapata commented Mar 15, 2018

I think the problem is with some update of the axe-core because in an old version (2.0.7 for example) the filter is working but with a fresh install of the modules the filter is not working.

I will check it.

@jrtnq514
Copy link
Author

I believe the breaking change was in 2.6.0

@felixzapata
Copy link
Owner

I see it, but I think it is a little confused. I mean, the new rule is ok but it is not working with the filter or this rule is ignored by the filter?

@jrtnq514
Copy link
Author

Yeah it appears that the landmark-one-main rule is ignored by the filters.
I've found a work around in case anyone else runs into the same issue. Adding 'landmark-one-main': { enabled: false } to the rules works.

a11yCheckOptions: {
      rules: {
        'html-has-lang': { enabled: false },
        bypass: { enabled: false },
        'image-alt': { enabled: false },
        'landmark-one-main': { enabled: false }
      },
    },

@felixzapata
Copy link
Owner

Yes thanks, it works with your solution.

I'm going to open an issue in the axe-core repository about this problem.

@felixzapata
Copy link
Owner

@jrtnq514 I've published a few days ago a major version of the package with updates of the aXe libraries. Maybe with the new version, the problem with the filtering being resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants