Ignore Rules

Link to Ignore Rules copied to clipboard

Supported within:
axeDevTools UIKit framework axeDevTools XCUI framework

You can choose to ignore specified rules while testing 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 more on unknown or new issues.

important

In the below examples, axe refers to the AxeDevTools object initialized when logging in.

APIs Available

To ignore a specific rule or set of rules, update the configuration before testing takes place.

Ignore Rule(s)

The below code shows how to ignore a specific rule, ConflictingTraits.

axe?.configuration.ignore(rule: AxeRuleId.ConflictingTraits.toString())

To ignore multiple rules:

axe?.configuration.ignore(rules: [AxeRuleId.ConflictingTraits.toString(), AxeRuleId.InScrollView.toString()])

Ignore Rules by Class Name

Note: Supports class names and accessibility identifiers.

axe?.configuration.ignore(rulesFor: ["UILabel": [AxeRuleId.InScrollView.toString()]])

Ignore Rules by Accessibility Identifier

Note: Supports class names and accessibility identifiers.

axe?.configuration.ignore(rulesFor: ["LoginScreen.Button": [AxeRuleId.CollidingViews.toString()]])

Ignore Rules with Manual Testing

Note: Only available within axeDevToolsUIKit.xcframework

To ignore rules while testing with the floating action button, update the configuration before calling the showA11yFAB function.

axe?.configuration.ignore(rulesFor: ["UILabel": [AxeRuleId.InScrollView.toString()], "LoginScreen.Button": [AxeRuleId.CollidingControls.toString()]])

// Start the Floating Action Button
axe?.showA11yFAB()

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.