|
1 | 1 | /** |
2 | | - * Ignores and known false positives after human inspection. |
| 2 | + * Explicit exclusions and known false positives after human inspection. |
3 | 3 | * |
4 | | - * Maps rule IDs to an array of CSS selectors that should be excluded from violations. |
| 4 | + * Maps rule IDs to CSS selectors that should be excluded from the reported violations. |
5 | 5 | * These are instances where axe-core flags a violation, but after human review, |
6 | 6 | * the pattern is acceptable or represents a known limitation of the automated check. |
7 | 7 | * |
8 | | - * SELECTOR MATCHING: Uses substring matching. An exclusion pattern matches a violation's |
9 | | - * target selector if the pattern appears as a substring. For example: |
10 | | - * - A violation reports a Target Selector: "th[aria-label="Privacy Policy"] > strong > .row-title". |
11 | | - * - Pattern ".row-title" MATCHES (substring found). |
12 | | - * - Pattern "strong > .row-title" MATCHES (substring found). |
13 | | - * - Pattern ".column-title .row-title" does NOT match (not a substring). |
| 8 | + * SELECTOR MATCHING: |
| 9 | + * Uses space-separated selector tokens. An exclusion pattern matches a violation's |
| 10 | + * target selector if all selector tokens appear in order (but not necessarily |
| 11 | + * consecutively). Intermediate selectors can be skipped. |
| 12 | + * For example: |
| 13 | + * - Violation Target Selector: "html > body > #__wp-uploader > .attachments-browser > .attachments-wrapper > li[aria-label="image-1"]". |
| 14 | + * - Pattern ".attachments-browser li" MATCHES (skips .attachments-wrapper; all tokens found in order). |
| 15 | + * - Pattern ".attachments-browser .attachments-wrapper" MATCHES (all tokens found). |
| 16 | + * - Pattern ".attachments-browserxyz" does NOT match (selector token boundary prevents partial matches). |
| 17 | + * - Attributes on target selectors are ignored: "li[aria-label="..."]" matches pattern "li". |
| 18 | + * |
| 19 | + * WILDCARD SUPPORT: |
| 20 | + * Use an asterisk * to match any characters in a selector token. For example: |
| 21 | + * - Pattern "#wp-admin-bar-*" matches "#wp-admin-bar-site-name", "#wp-admin-bar-updates", etc. |
| 22 | + * - Pattern "#wpadminbar #wp-toolbar #wp-admin-bar-*" matches full descendant chains with variable final selectors. |
| 23 | + * |
| 24 | + * CONSTRAINTS: |
| 25 | + * Exclusion patterns must be space-separated tokens only (e.g., '#id .class li'). |
| 26 | + * Do not use attribute selectors, pseudo-classes, or explicit combinators (>, +, ~) in patterns. |
| 27 | + * Spaces implicitly represent descendant relationships (any number of intermediate selectors). |
| 28 | + * |
| 29 | + * NOTE: |
| 30 | + * The passed pattern isn't meant to be a meaningful CSS selector. It's only used |
| 31 | + * to match the Axe-core target selector of a violation. Just use a space-separated |
| 32 | + * list of tokens that appear in the 'Target Selector' entry of the reported violation. |
14 | 33 | */ |
15 | 34 |
|
16 | 35 | module.exports = { |
17 | 36 | 'link-in-text-block': [ |
18 | 37 | // Post title links in list tables may have surrounding text and are only distinguished by color. |
19 | 38 | // We consider this acceptable as these links can be distinguished by the context. |
20 | | - 'strong > .row-title', |
21 | | - 'a[aria-label="Edit', |
| 39 | + '.wp-list-table strong .row-title', |
22 | 40 | ], |
23 | 41 | 'aria-allowed-role': [ |
24 | 42 | // The "group" role for the admin bar list items is flagged as invalid by axe-core. |
25 | 43 | // This is a known false positive in axe-core and can be ignored. Note |
26 | 44 | // that the 'aria-allowed-role' rule is part of the 'best-practice' rules group. |
27 | | - '#wp-admin-bar-', |
| 45 | + '#wp-toolbar #wp-admin-bar-*', |
28 | 46 | ], |
29 | 47 | 'region': [ |
30 | 48 | // Visually hidden text that clarifies what the ARIA live regions are about. |
|
0 commit comments