Ignore Rules

Link to Ignore Rules copied to clipboard

Supported within:
XML

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 essential, 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, EditTextName.

axe.ignoreRules(listOf("EditTextName"))

Ignore Some Rules by View ID

A set of rules that will be ignored for the assigned view ID.

axe.ignoreByViewId(mapOf(
    R.id.your_view_id to setOf(CustomRule::class.java)
))

Ignore All Rules by View ID

Ignores all rules for the provided view IDs.

axe.ignoreAllByViewId(setOf(R.id.your_view_id))

Ignore Some Rules by View

A set of rules that will be ignored for the provided views.

axe.ignoreByView(mapOf(
    view to setOf(CustomRule::class.java)
))

Ignore All Rules by View

Ignores all rules for the provided views.

axe.ignoreAllByView(setOf(view))

Ignore Some Rules by Class Name

A set of rules that will be ignored for the provided class names.

axe.ignoreByClassName(mapOf(
    TextView::class.java to setOf(CustomRule::class.java)
))

Ignore All Rules by Class Name

Ignores all rules for the provided class names.

axe.ignoreAllByClassName(setOf(TextView::class.java))