Ignore Rules
Axe Account admins can choose which accessibility rules run for their organization's mobile scans, and allow team users to ignore additional rules in their automated tests. When this option isn't selected, developers can't skip (or "ignore") a built-in rule from their test code.
Rule ignores are now allowed for developers using an access token or an offline license key, and they will no longer be affected when reading the org's settings fails.
You can indicate rules to ignore while testing for accessibility. We support ignoring a specific rule, ignoring rules by class name, and ignoring rules by accessibility identifier. While we feel that all rules are important, these customizations will let you ignore views that have yet to be fixed and focus on identifying new issues.
APIs Available
To ignore a specific rule or set of rules, update the configuration before testing takes place.
Note: In the following examples, axe refers to the AxeDevTools object that is initialized when logging in.
Ignore Rules
The below code shows how to ignore a specific rule, ConflictingTraits.
Rules ignored with this API will not run and therefore will not be available within Axe Developer Hub.
axe?.ignoreRules(.ConflictingTraits.toString())To ignore multiple rules, separate rules with commas:
axe?.ignoreRules(.ConflictingTraits, .InScrollView)Ignore Rules by Class Name
Rules ignored with this API will not run and therefore will not be available within Axe Developer Hub.
axe?.ignoreRules(onElementOfClass:"UILabel", .clippedText)Ignore Rules by Accessibility Identifier
Rules ignored with this API will not run and therefore will not be available within Axe Developer Hub.
axe?.ignoreRules(onElementWithId: "loginButton", .colorContrast)Ignore Rules with Automated Testing
To ignore rules while running unit or UI tests, update the configuration before your tests run. We recommend utilizing the setUp and tearDown methods.
