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

Disable a check #112

Closed
kennygrubb opened this issue Jun 25, 2020 · 5 comments
Closed

Disable a check #112

kennygrubb opened this issue Jun 25, 2020 · 5 comments

Comments

@kennygrubb
Copy link

kennygrubb commented Jun 25, 2020

I would like to disable the fallback role check.

Using axe directly, I can do this.

axe.configure({
  checks: [
    {
      id: 'fallbackrole'
      enabled: false
    }
  ]
});

However, I don't see a way to configure checks through jest-axe. Thanks

@NickColley
Copy link
Owner

Hello :)

You'd do this with the global configuration option: https://github.com/nickcolley/jest-axe#setting-global-configuration

const axe = configureAxe({
  checks: [
    {
      id: 'fallbackrole'
      enabled: false
    }
  ]
})

Please re-open if this doesnt work for you :)

@dwightjack
Copy link
Contributor

Hello,

First of all, thanks for this great library.

I stumbled upon this issue while trying to add a custom rule to axe-core.

Looking to the source code, it seems to me that it is not possible to customize checks and add rules via the configureAxe because it supports options for the axe.run method instead of the ones for axe.configure.

Am I getting it wrong?

@NickColley
Copy link
Owner

Hmm I think you're right, I'm not familiar with the difference between a 'check' and a 'rule'. If you can give me some examples of both and how they related I may be able to figure this out with you.

I'll re-open this. I also have limited time so would welcome a pull request if you figure it out without me.

@NickColley NickColley reopened this Jul 10, 2020
@dwightjack
Copy link
Contributor

I'm pretty new to axe custom rules as well. From what I understand, with a rule you match the elements that need to be tested, and with a check you actually check those elements. So to add a new rule you usually have to define both.

I might have some time next week to submit a PR with possible solutions. In the meanwhile importing axe-core and using axe.configuration before running tests seems to work, but that's prone to unexpected side effects I guess.

@NickColley
Copy link
Owner

Thank you @kennygrubb for raising and @dwightjack for sorting, this is released as 3.5.0

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

No branches or pull requests

3 participants