Ignore Rules
Supported within:
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.
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(mutableMapOf(
R.id.your_view_id to mutableSetOf(CustomRule::class.java)
))
Ignore All Rules by View ID
Ignores all rules for the provided view IDs.
axe.ignoreAllByViewId(mutableSetOf(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))