dequelabs / dequelabs/axe-core

Disable specific rules for specific locators in axe-core scan

Open
#4,417 5 comments 3 reactions 0 assignees View on GitHub
feat
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 13h
Merged PRs (30d)
29

Description

Product: playwright

Expectation: Disable rules for a specific selector in an axe scan

Actual: Can either disable

* All rules for one locator and its descendants
* One rule for the entire scan

Motivation: Even if the scanned element has an invalid rule inside one of its subtrees. It's still worth running other rules for that its subtree.

Let's take this example

```html






```

There are two rules that are being violated here:
1. [button does not have accessible name](https://dequeuniversity.com/rules/axe/4.1/button-name)
2. [ids are not unique](https://dequeuniversity.com/rules/axe/4.3/duplicate-id#:~:text=Duplicate%20IDs%20are%20common%20validation,be%20sure%20each%20is%20unique.)

If I test the entire UI markup here, there's no way for me ignore a specific rule for one of the problematic buttons (if they happen to be an exception). In fact, it's possible to mistakenly exclude one of the problematic buttons or rules and get a less accurate result from the scan.



axe-core version: 4.9.0
@axe-core/playwright: 4.9.0

- Node version: 20
- Platform: Mac, Linux, Windows


Contributor guide

Open the contributing guide

Research direction

Start by reviewing the axe-core scan configuration and the @axe-core/playwright integration described in the issue, focusing on how rule exclusions and locator scopes are currently represented. Define a way to exclude one rule for one locator while preserving other checks in that subtree, and verify that the example's button-name and duplicate-id violations can be handled independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, playwright
Domain
accessibility, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.