@surea11y/core 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +193 -149
- package/README.md +27 -6
- package/docs/ACT_RULE_MAPPING.md +243 -0
- package/docs/API_STABILITY.md +2 -2
- package/docs/BINDING_AUTHORS_GUIDE.md +3 -3
- package/docs/DESIGN_CHALLENGES.md +301 -0
- package/docs/ENGINE_OPTIONS.md +16 -4
- package/docs/I18N.md +4 -4
- package/docs/INTEGRATION.md +1 -1
- package/docs/LIMITATIONS.md +6 -4
- package/docs/REPORT.md +1 -1
- package/docs/RULE_AUTHORING.md +53 -25
- package/docs/RULE_CATALOG.md +1878 -169
- package/docs/RULE_TAXONOMY.md +2 -2
- package/docs/TROUBLESHOOTING.md +2 -2
- package/docs/WCAG_CONFORMANCE.md +25 -9
- package/package.json +3 -7
- package/src/baseline.js +3 -3
- package/src/checks/automatic/area-alt-present.js +2 -2
- package/src/checks/automatic/aria-allowed-attr.js +68 -10
- package/src/checks/automatic/aria-allowed-role.js +2 -2
- package/src/checks/automatic/aria-braille-equivalent.js +3 -3
- package/src/checks/automatic/aria-conditional-attr.js +5 -5
- package/src/checks/automatic/aria-deprecated-role.js +1 -1
- package/src/checks/automatic/aria-hidden-body.js +2 -2
- package/src/checks/automatic/aria-hidden-focus.js +5 -5
- package/src/checks/automatic/aria-prohibited-attr.js +18 -18
- package/src/checks/automatic/aria-prohibited-children.js +130 -37
- package/src/checks/automatic/aria-required-attr.js +60 -12
- package/src/checks/automatic/aria-required-children.js +21 -14
- package/src/checks/automatic/aria-required-parent.js +61 -9
- package/src/checks/automatic/aria-role-name-present.js +36 -22
- package/src/checks/automatic/aria-valid-attr-value.js +15 -12
- package/src/checks/automatic/aria-valid-attr.js +1 -1
- package/src/checks/automatic/autocomplete-valid.js +2 -2
- package/src/checks/automatic/binary-control-name-present.js +27 -5
- package/src/checks/automatic/button-name-present.js +92 -6
- package/src/checks/automatic/combobox-name-present.js +26 -6
- package/src/checks/automatic/contrast-computable.js +32 -0
- package/src/checks/automatic/contrast-enhanced.js +21 -1
- package/src/checks/automatic/contrast-minimum.js +21 -1
- package/src/checks/automatic/css-orientation-lock.js +96 -19
- package/src/checks/automatic/definition-list-children-valid.js +7 -8
- package/src/checks/automatic/deprecated-elements-not-used.js +1 -1
- package/src/checks/automatic/dialog-name-present.js +20 -2
- package/src/checks/automatic/duplicate-id-aria.js +5 -3
- package/src/checks/automatic/duplicate-id.js +198 -0
- package/src/checks/automatic/embed-text-alternative-present.js +2 -2
- package/src/checks/automatic/form-control-programmatic-label-present.js +19 -2
- package/src/checks/automatic/form-control-single-label.js +1 -1
- package/src/checks/automatic/iframe-focusable-content.js +63 -7
- package/src/checks/automatic/iframe-name-present.js +37 -3
- package/src/checks/automatic/iframe-title-unique.js +1 -1
- package/src/checks/automatic/img-alt-present.js +12 -4
- package/src/checks/automatic/label-in-name.js +172 -18
- package/src/checks/automatic/link-in-text-block.js +10 -10
- package/src/checks/automatic/link-name-present.js +22 -1
- package/src/checks/automatic/list-children-valid.js +6 -6
- package/src/checks/automatic/listbox-name-present.js +28 -8
- package/src/checks/automatic/listitem-parent-valid.js +4 -4
- package/src/checks/automatic/menuitem-name-present.js +20 -2
- package/src/checks/automatic/meta-refresh-no-exceptions.js +25 -14
- package/src/checks/automatic/meta-refresh-timing-absent.js +14 -7
- package/src/checks/automatic/meter-name-present.js +23 -4
- package/src/checks/automatic/nested-interactive-controls-absent.js +5 -5
- package/src/checks/automatic/option-name-present.js +23 -4
- package/src/checks/automatic/page-title-present.js +21 -3
- package/src/checks/automatic/presentational-children-focusable-absent.js +330 -0
- package/src/checks/automatic/progressbar-name-present.js +23 -4
- package/src/checks/automatic/role-img-alt-present.js +64 -16
- package/src/checks/automatic/searchbox-name-present.js +28 -8
- package/src/checks/automatic/server-side-image-map-absent.js +1 -1
- package/src/checks/automatic/slider-name-present.js +27 -6
- package/src/checks/automatic/spinbutton-name-present.js +28 -8
- package/src/checks/automatic/summary-name-present.js +18 -2
- package/src/checks/automatic/svg-image-text-alternative-present.js +1 -1
- package/src/checks/automatic/svg-text-alternative-present.js +13 -10
- package/src/checks/automatic/tab-name-present.js +21 -2
- package/src/checks/automatic/table-headers-attr-valid.js +43 -8
- package/src/checks/automatic/table-th-has-data-cells.js +61 -5
- package/src/checks/automatic/target-size-minimum.js +71 -53
- package/src/checks/automatic/td-has-header.js +5 -5
- package/src/checks/automatic/textbox-name-present.js +28 -8
- package/src/checks/automatic/tooltip-name-present.js +21 -2
- package/src/checks/automatic/treeitem-name-present.js +23 -4
- package/src/checks/automatic/valid-lang.js +92 -7
- package/src/checks/automatic/video-poster-text-alternative-present.js +1 -1
- package/src/checks/manual/accesskeys-manual.js +3 -3
- package/src/checks/manual/area-alt-decorative-manual.js +7 -0
- package/src/checks/manual/area-alt-quality-manual.js +6 -0
- package/src/checks/manual/aria-checked-state-mismatch-manual.js +5 -5
- package/src/checks/manual/aria-text-manual.js +4 -4
- package/src/checks/manual/bypass-blocks-present-manual.js +44 -26
- package/src/checks/manual/canvas-text-alternative-quality-manual.js +8 -0
- package/src/checks/manual/css-focus-indicator-suppressed-manual.js +444 -0
- package/src/checks/manual/embed-text-alternative-quality-manual.js +8 -0
- package/src/checks/manual/empty-heading-manual.js +58 -11
- package/src/checks/manual/empty-table-header-manual.js +8 -8
- package/src/checks/manual/focus-order-semantics-manual.js +15 -15
- package/src/checks/manual/form-control-label-quality-manual.js +453 -0
- package/src/checks/manual/form-control-programmatic-label-quality-manual.js +2 -2
- package/src/checks/manual/heading-order-manual.js +3 -3
- package/src/checks/manual/heading-quality-manual.js +338 -0
- package/src/checks/manual/identical-links-same-purpose-manual.js +73 -12
- package/src/checks/manual/image-redundant-alt-manual.js +4 -4
- package/src/checks/manual/img-alt-decorative-manual.js +211 -52
- package/src/checks/manual/img-alt-quality-manual.js +7 -0
- package/src/checks/manual/input-image-alt-decorative-manual.js +8 -0
- package/src/checks/manual/input-image-alt-quality-manual.js +5 -0
- package/src/checks/manual/label-title-only-manual.js +4 -4
- package/src/checks/manual/landmark-banner-is-top-level-manual.js +7 -7
- package/src/checks/manual/landmark-contentinfo-is-top-level-manual.js +9 -9
- package/src/checks/manual/landmark-main-is-top-level-manual.js +6 -6
- package/src/checks/manual/landmark-no-duplicate-banner-manual.js +6 -6
- package/src/checks/manual/landmark-no-duplicate-contentinfo-manual.js +6 -6
- package/src/checks/manual/landmark-no-duplicate-main-manual.js +2 -2
- package/src/checks/manual/landmark-one-main-manual.js +6 -6
- package/src/checks/manual/landmark-unique-manual.js +9 -9
- package/src/checks/manual/link-name-quality-manual.js +161 -32
- package/src/checks/manual/media-transcript-present-manual.js +2 -3
- package/src/checks/manual/meta-viewport-large-manual.js +2 -2
- package/src/checks/manual/mouse-only-event-handlers-manual.js +9 -9
- package/src/checks/manual/no-autoplay-audio-manual.js +3 -3
- package/src/checks/manual/object-text-alternative-quality-manual.js +8 -0
- package/src/checks/manual/p-as-heading-manual.js +4 -4
- package/src/checks/manual/page-has-heading-one-manual.js +6 -6
- package/src/checks/manual/page-title-patterns-manual.js +26 -3
- package/src/checks/manual/presentation-role-conflict-manual.js +55 -25
- package/src/checks/manual/region-manual.js +19 -19
- package/src/checks/manual/scope-attr-valid-manual.js +2 -2
- package/src/checks/manual/scrollable-region-focusable-manual.js +7 -7
- package/src/checks/manual/skip-link-manual.js +5 -5
- package/src/checks/manual/svg-text-alternative-quality-manual.js +9 -0
- package/src/checks/manual/tabindex-manual.js +2 -2
- package/src/checks/manual/table-duplicate-name-manual.js +2 -2
- package/src/checks/manual/table-fake-caption-manual.js +2 -2
- package/src/checks/manual/video-caption-manual.js +3 -3
- package/src/checks/manual-review.js +17 -1
- package/src/core.js +8965 -1647
- package/src/report.js +2 -2
- package/surea11y.browser.js +3768 -611
- package/surea11y.i18n.de.js +1 -1
- package/surea11y.i18n.es.js +1 -1
- package/surea11y.i18n.fr.js +1 -1
- package/bin/surea11y-core.js +0 -20
package/docs/RULE_TAXONOMY.md
CHANGED
|
@@ -24,7 +24,7 @@ Manual rules MUST NOT make normative failure decisions.
|
|
|
24
24
|
### 1.2 Intent
|
|
25
25
|
Encoded by: **rule id suffix**
|
|
26
26
|
|
|
27
|
-
Illustrative intents (from the image-alternatives family used as the running example in §2, not an exhaustive list — the ruleset's
|
|
27
|
+
Illustrative intents (from the image-alternatives family used as the running example in §2, not an exhaustive list — the ruleset's 130 rules use dozens of distinct suffixes; `docs/RULE_CATALOG.md` is the generated, always-current list):
|
|
28
28
|
|
|
29
29
|
- `present`
|
|
30
30
|
- Verifies that a required **mechanism exists**
|
|
@@ -43,7 +43,7 @@ Intent determines whether a rule can be automatic.
|
|
|
43
43
|
### 1.3 Target Family
|
|
44
44
|
Encoded by: **rule id prefix**
|
|
45
45
|
|
|
46
|
-
Illustrative families, from the image-alternatives cluster (WCAG 1.1.1) used as the running example in §2 — not an exhaustive list. The ruleset's
|
|
46
|
+
Illustrative families, from the image-alternatives cluster (WCAG 1.1.1) used as the running example in §2 — not an exhaustive list. The ruleset's 130 rules span dozens of families (`aria-*`, `contrast-*`, `dialog-*`, `iframe-*`, `label-*`, `link-*`, `list-*`, `landmark-*`, and more); see `docs/RULE_CATALOG.md` for the generated, always-current list:
|
|
47
47
|
|
|
48
48
|
- `img`
|
|
49
49
|
- `area`
|
package/docs/TROUBLESHOOTING.md
CHANGED
|
@@ -18,7 +18,7 @@ Check the result's `error` field first — if it says `"<something> is not defin
|
|
|
18
18
|
|
|
19
19
|
## "A geometry-dependent rule (e.g. `target-size-minimum`) always says `notApplicable`"
|
|
20
20
|
|
|
21
|
-
Plain jsdom (no real browser) doesn't implement CSS layout — `getBoundingClientRect()` always returns zero geometry. Rules that need real layout
|
|
21
|
+
Plain jsdom (no real browser) doesn't implement CSS layout — `getBoundingClientRect()` always returns zero geometry. Rules that need real layout report `notApplicable` under jsdom rather than guess. Run through a real browser instead (Puppeteer/Playwright — see [`INTEGRATION.md`](./INTEGRATION.md) Pattern 2) to get real findings from these rules. See [`LIMITATIONS.md`](./LIMITATIONS.md).
|
|
22
22
|
|
|
23
23
|
## "I only see `fail`/`cantTell` occurrences — where's the list of elements that passed?"
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ By design, this engine never enumerates the elements a rule *passed* — only th
|
|
|
28
28
|
|
|
29
29
|
Two common causes, in order of likelihood:
|
|
30
30
|
|
|
31
|
-
1. **The element is excluded from the accessibility tree** — `aria-hidden="true"`, `display: none`, `visibility: hidden`, `hidden`, or an `inert` ancestor. Most rules
|
|
31
|
+
1. **The element is excluded from the accessibility tree** — `aria-hidden="true"`, `display: none`, `visibility: hidden`, `hidden`, or an `inert` ancestor. Most rules skip content that's already invisible to assistive technology, since checking a hidden element would be meaningless and could produce a misleading `fail` on content no user encounters. Some rules explicitly opt out of this gating when it wouldn't make sense to (e.g. `no-autoplay-audio` — hidden audio still plays sound) — check the specific rule's file header comment (`@applicability`) in `src/checks/`.
|
|
32
32
|
2. **`excludeSelectors`** — if you've configured this (directly or inherited from a shared config), confirm the element in question isn't matched by it. Remember this can also be scoped to a single rule via `engineOptions.rules[ruleId].excludeSelectors` (see [`ENGINE_OPTIONS.md`](./ENGINE_OPTIONS.md#rule-scoped-excludeselectors)) — if a rule you expect to fire keeps coming back `notApplicable`/`pass` for one element only, check whether that rule specifically has its own exclude list configured, not just the global one.
|
|
33
33
|
|
|
34
34
|
## "Does a clean scan (`pass` everywhere) mean the page is WCAG conformant?"
|
package/docs/WCAG_CONFORMANCE.md
CHANGED
|
@@ -4,9 +4,9 @@ How individual rule results relate to a WCAG Success Criterion (SC), and what su
|
|
|
4
4
|
|
|
5
5
|
## The three layers
|
|
6
6
|
|
|
7
|
-
1. **Atomic rules** (`checksResults[]`) — one normative decision each, e.g. "does this `<img>` have an `alt` attribute." See [`RULE_CATALOG.md`](./RULE_CATALOG.md) for all
|
|
7
|
+
1. **Atomic rules** (`checksResults[]`) — one normative decision each, e.g. "does this `<img>` have an `alt` attribute." See [`RULE_CATALOG.md`](./RULE_CATALOG.md) for all 130.
|
|
8
8
|
2. **Facets** — a WCAG SC is usually bigger than any one rule can decide deterministically. Internally, each SC is broken into named "facets" (e.g. 1.1.1 Non-text Content has facets like `img-alt-attr-present`, `text-alternative-quality`, `decorative-null`) tracked in `src/coverage/wcag-facets.js`, each marked `full` (a rule decides it with high confidence), `partial` (a rule decides *part* of it — see each rule's own scope notes), or `manual` (no safe automated heuristic exists at all). Run `npm run coverage` to regenerate `coverage/coverage-report.md`, the per-SC facet breakdown.
|
|
9
|
-
3. **Composite (WCAG-SC rollup) rules** (`rulesResults[]`) — a generated aggregate of every atomic rule mapped to one SC, giving you one pass/fail/cantTell/notApplicable verdict per SC instead of having to roll up dozens of atomic results yourself. See [`RULE_CATALOG.md`](./RULE_CATALOG.md#composite-wcag-sc-rollup-rules-
|
|
9
|
+
3. **Composite (WCAG-SC rollup) rules** (`rulesResults[]`) — a generated aggregate of every atomic rule mapped to one SC, giving you one pass/fail/cantTell/notApplicable verdict per SC instead of having to roll up dozens of atomic results yourself. See [`RULE_CATALOG.md`](./RULE_CATALOG.md#composite-wcag-sc-rollup-rules-33) for the full list (e.g. `wcag-1.1.1-non-text-content` rolls up 22 atomic rules).
|
|
10
10
|
|
|
11
11
|
## How a composite's outcome is computed
|
|
12
12
|
|
|
@@ -25,17 +25,33 @@ A composite's `data.details.contributors` array (see [`OUTPUT_SCHEMA.md`](./OUTP
|
|
|
25
25
|
|
|
26
26
|
## Targeting a conformance level (A / AA / AAA)
|
|
27
27
|
|
|
28
|
-
Pass `runOnly.tags` (or `engineOptions.tags.include`) with
|
|
28
|
+
Pass `runOnly.tags` (or `engineOptions.tags.include`) with the level tags you want:
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
|
-
|
|
31
|
+
// WCAG 2.0 A and AA. Both tags are required: they are not cumulative.
|
|
32
|
+
runDomRulesInPage(url, null, {}, { tags: ['wcag2a', 'wcag2aa'] });
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
**Level tags do not nest, and this is the easiest thing to get wrong here.** A rule
|
|
36
|
+
carries one level tag per Success Criterion it maps to, and nothing more: a rule
|
|
37
|
+
mapped only to an AA criterion is tagged `wcag2aa` and *not* `wcag2a`. Asking for
|
|
38
|
+
`{ tags: ['wcag2aa'] }` on its own therefore runs the 10 rules mapped to a 2.0 AA
|
|
39
|
+
criterion, not the ~100 that make up an A + AA target. List every level you mean.
|
|
40
|
+
|
|
41
|
+
The same applies across WCAG versions — a criterion introduced in 2.1 or 2.2 carries
|
|
42
|
+
only its own origin tag — so a full conformance target is a union of tag sets. See
|
|
43
|
+
[`ENGINE_OPTIONS.md`](./ENGINE_OPTIONS.md#filtering-by-wcag-version-21-vs-22) for the
|
|
44
|
+
ready-made sets per version, including the one criterion WCAG 2.2 removed rather than
|
|
45
|
+
added.
|
|
46
|
+
|
|
47
|
+
Composites, unlike atomic rules, *are* filtered cumulatively. The runner reads the
|
|
48
|
+
highest level named in `tags` and drops every composite above it, so requesting
|
|
49
|
+
`['wcag2a', 'wcag2aa']` returns no `rulesResults` entry for an AAA-only SC. That is
|
|
50
|
+
`inferTargetLevelFromRunOnly`/`isAllowedByTargetLevel` in `src/core/dom-runner.js` if
|
|
51
|
+
you need the exact precedence.
|
|
52
|
+
|
|
53
|
+
Omit `tags` entirely (the default) and every rule at every level runs, with no composite
|
|
54
|
+
suppression.
|
|
39
55
|
|
|
40
56
|
## What this engine cannot tell you
|
|
41
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surea11y/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Deterministic WCAG 2.2 accessibility engine that tells you what it can't tell you. Zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -25,9 +25,6 @@
|
|
|
25
25
|
"vitest"
|
|
26
26
|
],
|
|
27
27
|
"main": "src/index.js",
|
|
28
|
-
"bin": {
|
|
29
|
-
"surea11y-core": "bin/surea11y-core.js"
|
|
30
|
-
},
|
|
31
28
|
"exports": {
|
|
32
29
|
".": "./src/index.js",
|
|
33
30
|
"./baseline": "./src/baseline.js",
|
|
@@ -59,7 +56,6 @@
|
|
|
59
56
|
"src/report.js",
|
|
60
57
|
"src/sarif.js",
|
|
61
58
|
"src/checks/**/*.js",
|
|
62
|
-
"bin/surea11y-core.js",
|
|
63
59
|
"surea11y.browser.js",
|
|
64
60
|
"surea11y.i18n.*.js",
|
|
65
61
|
"docs/**/*.md",
|
|
@@ -74,8 +70,8 @@
|
|
|
74
70
|
"scripts": {
|
|
75
71
|
"lint": "eslint .",
|
|
76
72
|
"lint:fix": "eslint . --fix",
|
|
77
|
-
"format": "prettier --write \"src/**/*.js\" \"
|
|
78
|
-
"format:check": "prettier --check \"src/**/*.js\" \"
|
|
73
|
+
"format": "prettier --write \"src/**/*.js\" \"scripts/**/*.js\" \"tests/**/*.js\" \"eslint.config.js\"",
|
|
74
|
+
"format:check": "prettier --check \"src/**/*.js\" \"scripts/**/*.js\" \"tests/**/*.js\" \"eslint.config.js\"",
|
|
79
75
|
"build": "node scripts/build-core.js && node scripts/build-browser.js",
|
|
80
76
|
"pretest": "playwright install chromium",
|
|
81
77
|
"test": "npm run format:check && npm run build && node scripts/run-tests.js",
|
package/src/baseline.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
// docs/BASELINE.md: identity for one violation occurrence is
|
|
6
|
-
// `ruleId + reasonCode + html
|
|
6
|
+
// `ruleId + reasonCode + html`, on purpose NOT `selector`/`structuralPath`
|
|
7
7
|
// (both position-derived, so they shift when unrelated markup changes
|
|
8
8
|
// elsewhere on the page; see buildSelector/buildStructuralPath in
|
|
9
9
|
// src/core/dom-helpers.js). Unlike src/explain/group.js's computeGroupKey,
|
|
10
|
-
// this does not use a coarse structural signature: that's
|
|
10
|
+
// this does not use a coarse structural signature: that's lossy on purpose
|
|
11
11
|
// for AI-explanation dedup (one prompt per shape), which would risk a CI gate
|
|
12
|
-
// silently treating
|
|
12
|
+
// silently treating an actually new violation as "known" just because it
|
|
13
13
|
// shares tag/class shape with an old baselined one -- the wrong failure mode
|
|
14
14
|
// here. Content-based matching survives incidental DOM changes elsewhere on
|
|
15
15
|
// the page; its known limitation is a flagged element with dynamic content
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
const id = 'area-alt-present';
|
|
22
22
|
|
|
23
23
|
const meta = {
|
|
24
|
-
title: '
|
|
24
|
+
title: '<area> must have an alt attribute',
|
|
25
25
|
description:
|
|
26
|
-
'Checks that
|
|
26
|
+
'Checks that <area> elements provide an alt attribute to support a text alternative mechanism.',
|
|
27
27
|
i18n: {
|
|
28
28
|
titleKey: 'area_altPresent_title',
|
|
29
29
|
descriptionKey: 'area_altPresent_description'
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* @standard WCAG 2.2
|
|
10
10
|
* @sc 4.1.2
|
|
11
11
|
* @applicability
|
|
12
|
-
* Applies to elements
|
|
13
|
-
*
|
|
12
|
+
* Applies to elements carrying at least one recognized, non-global
|
|
13
|
+
* aria-* attribute, judged against the role they actually have: an
|
|
14
|
+
* explicit valid role, else the implicit role of their tag, else, for
|
|
15
|
+
* the elements HTML-AAM maps to no role at all, nothing.
|
|
14
16
|
* @expectation
|
|
15
17
|
* Every recognized aria-* attribute present is either: (a) globally
|
|
16
18
|
* supported on any element (the "global" ARIA states/properties, e.g.
|
|
@@ -20,10 +22,19 @@
|
|
|
20
22
|
* still allowed: it is reported as CANTTELL (see helpers.aria.isDeprecatedAttr)
|
|
21
23
|
* so the author decides, not as a not-allowed FAIL.
|
|
22
24
|
* @implementation-notes
|
|
23
|
-
* -
|
|
24
|
-
*
|
|
25
|
-
* role
|
|
26
|
-
*
|
|
25
|
+
* - Three tiers of role resolution, in order: an explicit `role`; the
|
|
26
|
+
* implicit role of the tag (IMPLICIT_ROLE_BY_ELEMENT, generated only for
|
|
27
|
+
* elements whose role is the same in every context, see
|
|
28
|
+
* `scripts/generate-aria-tables.js` for what is excluded and why); and
|
|
29
|
+
* ROLELESS_ELEMENTS, the tags HTML-AAM gives no role at all. A
|
|
30
|
+
* role-specific attribute on one of those is supported by nothing, which
|
|
31
|
+
* is exactly ACT 5c01ea's `<audio controls aria-orientation="horizontal">`.
|
|
32
|
+
* An element whose role is context-dependent (`<a>`, `<section>`,
|
|
33
|
+
* `<td>`, ...) is still skipped rather than guessed at.
|
|
34
|
+
* - `<div>`/`<span>` resolve to `generic`, whose supported set is empty, so
|
|
35
|
+
* `<div aria-expanded="true">` is reported: the attribute announces
|
|
36
|
+
* nothing on an element with no widget semantics, which is a real defect
|
|
37
|
+
* and not a spec technicality.
|
|
27
38
|
* - SUPPORTED_ATTRS_BY_ROLE holds unambiguous, well-established ARIA facts:
|
|
28
39
|
* subclass relationships like `searchbox`==`textbox`; same-family widget
|
|
29
40
|
* properties like `columnheader`/`rowheader` sort/col-row-index/span
|
|
@@ -82,7 +93,7 @@ function runInPage(ctx) {
|
|
|
82
93
|
// Global ARIA states/properties supported on (almost) any element,
|
|
83
94
|
// regardless of role, per the WAI-ARIA "Global States and Properties" list.
|
|
84
95
|
// Declared inside runInPage (rather than at module scope) because the
|
|
85
|
-
// build inlines only this function's own source text
|
|
96
|
+
// build inlines only this function's own source text, see
|
|
86
97
|
// scripts/build-core.js header ("runInPage MUST be self-contained").
|
|
87
98
|
// <generated:aria-global-attrs>
|
|
88
99
|
const GLOBAL_ATTRS = [
|
|
@@ -109,8 +120,8 @@ function runInPage(ctx) {
|
|
|
109
120
|
];
|
|
110
121
|
// </generated:aria-global-attrs>
|
|
111
122
|
|
|
112
|
-
// Per-role supported (non-global) states/properties.
|
|
113
|
-
// conservative
|
|
123
|
+
// Per-role supported (non-global) states/properties.
|
|
124
|
+
// conservative, see src/core/aria-helpers.js file header for the same
|
|
114
125
|
// confidence-scoping rationale; only well-established, unambiguous
|
|
115
126
|
// role/attribute pairings from the WAI-ARIA role definitions are listed.
|
|
116
127
|
// <generated:aria-implicit-roles>
|
|
@@ -125,6 +136,7 @@ function runInPage(ctx) {
|
|
|
125
136
|
details: 'group',
|
|
126
137
|
dfn: 'term',
|
|
127
138
|
dialog: 'dialog',
|
|
139
|
+
div: 'generic',
|
|
128
140
|
dt: 'term',
|
|
129
141
|
em: 'emphasis',
|
|
130
142
|
fieldset: 'group',
|
|
@@ -149,6 +161,7 @@ function runInPage(ctx) {
|
|
|
149
161
|
p: 'paragraph',
|
|
150
162
|
progress: 'progressbar',
|
|
151
163
|
strong: 'strong',
|
|
164
|
+
span: 'generic',
|
|
152
165
|
sub: 'subscript',
|
|
153
166
|
sup: 'superscript',
|
|
154
167
|
textarea: 'textbox',
|
|
@@ -173,6 +186,10 @@ function runInPage(ctx) {
|
|
|
173
186
|
'[aria-activedescendant], [aria-autocomplete], [aria-checked], [aria-colcount], [aria-colindex], [aria-colspan], [aria-disabled], [aria-errormessage], [aria-expanded], [aria-haspopup], [aria-invalid], [aria-level], [aria-modal], [aria-multiline], [aria-multiselectable], [aria-orientation], [aria-placeholder], [aria-posinset], [aria-pressed], [aria-readonly], [aria-required], [aria-rowcount], [aria-rowindex], [aria-rowspan], [aria-selected], [aria-setsize], [aria-sort], [aria-valuemax], [aria-valuemin], [aria-valuenow], [aria-valuetext]';
|
|
174
187
|
// </generated:aria-implicit-roles>
|
|
175
188
|
|
|
189
|
+
// <generated:aria-roleless-elements>
|
|
190
|
+
const ROLELESS_ELEMENTS = new Set(['audio', 'video']);
|
|
191
|
+
// </generated:aria-roleless-elements>
|
|
192
|
+
|
|
176
193
|
// <generated:aria-role-attrs>
|
|
177
194
|
const SUPPORTED_ATTRS_BY_ROLE = {
|
|
178
195
|
alert: [],
|
|
@@ -806,6 +823,39 @@ function runInPage(ctx) {
|
|
|
806
823
|
const cantTellOccurrences = [];
|
|
807
824
|
let applicableCount = 0;
|
|
808
825
|
|
|
826
|
+
// An element HTML-AAM maps to no role has nothing to support a
|
|
827
|
+
// role-specific attribute, so every non-global one present is reported.
|
|
828
|
+
// Returns how many recognized aria-* attributes it carried, for the
|
|
829
|
+
// applicable count.
|
|
830
|
+
function rolelessOccurrences(el, tag) {
|
|
831
|
+
let seen = 0;
|
|
832
|
+
const attrs = el.attributes;
|
|
833
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
834
|
+
const name = String(attrs[i].name || '').toLowerCase();
|
|
835
|
+
if (name.slice(0, 5) !== 'aria-') continue;
|
|
836
|
+
if (!ariaHelpers.isValidAriaAttrName(name)) continue; // aria-valid-attr's concern
|
|
837
|
+
|
|
838
|
+
seen += 1;
|
|
839
|
+
if (globalSet.has(name)) continue;
|
|
840
|
+
|
|
841
|
+
failOccurrences.push(
|
|
842
|
+
helpers.reportOccurrence(el, {
|
|
843
|
+
summary: `<${tag}> has no ARIA role, so nothing supports the ${name} attribute on it.`,
|
|
844
|
+
hint: `Remove ${name}, or move it to an element whose role supports it. A role-specific ARIA attribute on an element with no role is ignored by assistive technology.`,
|
|
845
|
+
i18n: {
|
|
846
|
+
summaryKey: 'ariaAllowedAttr_summary_fail_roleless',
|
|
847
|
+
hintKey: 'ariaAllowedAttr_hint_fail_roleless',
|
|
848
|
+
params: { attr: name, element: tag }
|
|
849
|
+
},
|
|
850
|
+
data: {
|
|
851
|
+
details: { reasonCode: 'ARIA_ATTR_NOT_ALLOWED_ROLELESS', attr: name, element: tag }
|
|
852
|
+
}
|
|
853
|
+
})
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
return seen;
|
|
857
|
+
}
|
|
858
|
+
|
|
809
859
|
for (const el of nodes) {
|
|
810
860
|
if (!el || !el.attributes) continue;
|
|
811
861
|
|
|
@@ -824,6 +874,14 @@ function runInPage(ctx) {
|
|
|
824
874
|
role = Object.prototype.hasOwnProperty.call(IMPLICIT_ROLE_BY_ELEMENT, key)
|
|
825
875
|
? IMPLICIT_ROLE_BY_ELEMENT[key]
|
|
826
876
|
: '';
|
|
877
|
+
// No role from either source: for a tag HTML-AAM maps to no role at
|
|
878
|
+
// all, that IS the answer. Nothing supports a role-specific
|
|
879
|
+
// attribute here. Any other tag has a role this table does not model
|
|
880
|
+
// (context-dependent ones), so it stays out of scope.
|
|
881
|
+
if (!role && ROLELESS_ELEMENTS.has(tag)) {
|
|
882
|
+
applicableCount += rolelessOccurrences(el, tag);
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
827
885
|
}
|
|
828
886
|
if (!role || !ariaHelpers.isValidConcreteRole(role)) continue; // aria-roles-valid's concern
|
|
829
887
|
|
|
@@ -860,7 +918,7 @@ function runInPage(ctx) {
|
|
|
860
918
|
|
|
861
919
|
for (const name of disallowed) {
|
|
862
920
|
// A property ARIA deprecated (rather than prohibited) on this role is
|
|
863
|
-
// still allowed
|
|
921
|
+
// still allowed, surfaced as cantTell for the author to decide, not a
|
|
864
922
|
// not-allowed fail.
|
|
865
923
|
const deprecated =
|
|
866
924
|
typeof ariaHelpers.isDeprecatedAttr === 'function' &&
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
* The explicit role is one of the roles the ARIA-in-HTML specification
|
|
18
18
|
* permits for that host element.
|
|
19
19
|
* @implementation-notes
|
|
20
|
-
* -
|
|
20
|
+
* - Scoped to elements present in ALLOWED_ROLES_BY_ELEMENT;
|
|
21
21
|
* elements without an asserted constraint are treated as "no constraint"
|
|
22
|
-
* (not flagged) rather than guessed at
|
|
22
|
+
* (not flagged) rather than guessed at, see that table's header comment.
|
|
23
23
|
* - Not rule-gated on isAccTreeEligible: this remains a static-markup
|
|
24
24
|
* property, while engine-level hidden-subtree filtering still applies
|
|
25
25
|
* unless engineOptions.includeHiddenElements is true.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* - `aria-braillelabel`/`aria-brailleroledescription` do not participate
|
|
28
28
|
* in the standard accessible-name computation, so
|
|
29
29
|
* `helpers.getAccessibleNameInfo` already reflects only the "regular"
|
|
30
|
-
* (non-braille) name
|
|
30
|
+
* (non-braille) name, no special-casing needed there.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
const id = 'aria-braille-equivalent';
|
|
@@ -67,7 +67,7 @@ function runInPage(ctx) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function getConservativeSubtreeText(container) {
|
|
70
|
-
// "Name from content"
|
|
70
|
+
// "Name from content", recurses into descendants and uses each one's
|
|
71
71
|
// own accessible name (img alt, aria-label/aria-labelledby, title) when
|
|
72
72
|
// it has one, not just literal text nodes. See getContentNameInfo's
|
|
73
73
|
// header comment in src/core/dom-helpers.js for the full rationale
|
|
@@ -125,7 +125,7 @@ function runInPage(ctx) {
|
|
|
125
125
|
occurrences.push(
|
|
126
126
|
helpers.reportOccurrence(el, {
|
|
127
127
|
summary: `This element has ${m.attr} but no ${m.requires}, its non-braille equivalent.`,
|
|
128
|
-
hint: `${m.attr} is a Braille-specific supplement, not a replacement
|
|
128
|
+
hint: `${m.attr} is a Braille-specific supplement, not a replacement, so also provide ${m.requires}.`,
|
|
129
129
|
i18n: {
|
|
130
130
|
summaryKey: 'ariaBrailleEquivalent_summary_fail',
|
|
131
131
|
hintKey: 'ariaBrailleEquivalent_hint_fail',
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
* other than `"false"` (i.e. `"true"`, `"grammar"`, or `"spelling"`).
|
|
17
17
|
* An element with `aria-errormessage` but `aria-invalid` absent or
|
|
18
18
|
* `"false"` silently drops the error message from the accessibility
|
|
19
|
-
* tree
|
|
19
|
+
* tree, authors almost always intend it to be exposed.
|
|
20
20
|
* @implementation-notes
|
|
21
|
-
* - This is
|
|
21
|
+
* - This is narrow: the broader space is a table of many
|
|
22
22
|
* attribute/condition pairs. This rule implements only the one pairing
|
|
23
23
|
* (`aria-errormessage` / `aria-invalid`) that is unambiguous and
|
|
24
|
-
* explicitly stated in the ARIA spec, to keep `fail` high-confidence
|
|
24
|
+
* explicitly stated in the ARIA spec, to keep `fail` high-confidence,
|
|
25
25
|
* matches this repo's established pattern (see `aria-required-attr`/
|
|
26
26
|
* `aria-prohibited-attr` for the same "narrow but zero false positives"
|
|
27
27
|
* trade-off).
|
|
28
28
|
* - Does not check whether the `aria-errormessage` ID reference itself
|
|
29
|
-
* resolves to an existing element
|
|
29
|
+
* resolves to an existing element. That's `aria-valid-attr-value`'s
|
|
30
30
|
* concern, not this rule's.
|
|
31
31
|
*/
|
|
32
32
|
|
|
@@ -35,7 +35,7 @@ const id = 'aria-conditional-attr';
|
|
|
35
35
|
const meta = {
|
|
36
36
|
title: 'aria-errormessage requires aria-invalid to be set to a non-false value',
|
|
37
37
|
description:
|
|
38
|
-
'Checks that elements with aria-errormessage also have aria-invalid set to "true", "grammar", or "spelling"
|
|
38
|
+
'Checks that elements with aria-errormessage also have aria-invalid set to "true", "grammar", or "spelling"; otherwise the error message is dropped from the accessibility tree.',
|
|
39
39
|
i18n: {
|
|
40
40
|
titleKey: 'ariaConditionalAttr_title',
|
|
41
41
|
descriptionKey: 'ariaConditionalAttr_description'
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @applicability
|
|
12
12
|
* Applies to any element whose role attribute's first (used) token is a
|
|
13
13
|
* valid, non-abstract ARIA role that authors should not explicitly
|
|
14
|
-
* declare
|
|
14
|
+
* declare, either because WAI-ARIA has deprecated it (e.g. "directory",
|
|
15
15
|
* superseded by role="list") or because it is reserved for user-agent-
|
|
16
16
|
* internal use (role="generic", which ARIA 1.2 §5.4 says authors SHOULD
|
|
17
17
|
* NOT use in content).
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* @sc 1.3.1, 4.1.2
|
|
11
11
|
* @applicability
|
|
12
12
|
* Always applicable to any HTML document with a <body> element,
|
|
13
|
-
* independent of contextSelector/root scoping
|
|
13
|
+
* independent of contextSelector/root scoping, this is a whole-
|
|
14
14
|
* document concern, matching page-title-present's pattern of
|
|
15
15
|
* evaluating document.body directly rather than the scoped root.
|
|
16
16
|
* @expectation
|
|
17
17
|
* <body> does not have aria-hidden="true". Hiding the document body
|
|
18
18
|
* removes the entire page's content and structure from the
|
|
19
|
-
* accessibility tree at once
|
|
19
|
+
* accessibility tree at once, both 1.3.1 (Info and Relationships: the
|
|
20
20
|
* page's structure becomes entirely non-determinable) and 4.1.2 (Name,
|
|
21
21
|
* Role, Value: nothing in the document exposes a role/name/value any
|
|
22
22
|
* longer) apply.
|
|
@@ -109,7 +109,7 @@ function runInPage(ctx) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// Flat-tree ancestor walk (assignedSlot wins over parentNode, then shadow
|
|
112
|
-
// host)
|
|
112
|
+
// host), shared with every other rule via ctx.helpers.composedParent
|
|
113
113
|
// (src/core/dom-helpers.js), not reimplemented here, so a fix to the one
|
|
114
114
|
// canonical definition can't drift out of sync with this rule's copy.
|
|
115
115
|
const composedParent =
|
|
@@ -533,8 +533,8 @@ function runInPage(ctx) {
|
|
|
533
533
|
if (isDisabledFormControl(el)) return false;
|
|
534
534
|
|
|
535
535
|
// An explicit negative tabindex removes the element from the keyboard
|
|
536
|
-
// tab sequence entirely, regardless of tag
|
|
537
|
-
// recommended technique for safely hiding focusable content behind
|
|
536
|
+
// tab sequence entirely, regardless of tag. It's the standard,
|
|
537
|
+
// WAI-recommended technique for safely hiding focusable content behind
|
|
538
538
|
// aria-hidden (e.g. <button tabindex="-1"> / <a tabindex="-1"> inside
|
|
539
539
|
// an aria-hidden container). This cares about tabbability, not raw
|
|
540
540
|
// focusability. Such an element is still programmatically focusable
|
|
@@ -684,7 +684,7 @@ function runInPage(ctx) {
|
|
|
684
684
|
// Cheap check first: a plain ancestor-attribute walk with no CSS
|
|
685
685
|
// computation, vs. isActuallyFocusable's getComputedStyle-per-ancestor
|
|
686
686
|
// cost. Both conditions are required (AND), so checking whichever is
|
|
687
|
-
// cheaper first cannot change which elements end up in the bucket
|
|
687
|
+
// cheaper first cannot change which elements end up in the bucket,
|
|
688
688
|
// it only skips the expensive check for the (typically vast) majority
|
|
689
689
|
// of focusable candidates that were never inside an aria-hidden root
|
|
690
690
|
// in the first place. On pages with many focusable candidates and a
|
|
@@ -903,7 +903,7 @@ function runInPage(ctx) {
|
|
|
903
903
|
|
|
904
904
|
// See helpers.resolveTieredOutcome's own header comment (src/core/dom-helpers.js):
|
|
905
905
|
// a fail-tier finding never silently discards cantTell-tier findings from
|
|
906
|
-
// the same run
|
|
906
|
+
// the same run, both are returned together when the outcome is 'fail'.
|
|
907
907
|
const resolved = helpers.resolveTieredOutcome(
|
|
908
908
|
failOccurrences,
|
|
909
909
|
uncertainOccurrences,
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
* list for naming attributes (pure text-semantics / non-naming
|
|
15
15
|
* structural roles: caption, code, deletion, emphasis, generic,
|
|
16
16
|
* insertion, mark, none, paragraph, presentation, strong, subscript,
|
|
17
|
-
* suggestion, superscript, time), and (b) elements with no role at all
|
|
17
|
+
* suggestion, superscript, time), and (b) elements with no role at all:
|
|
18
18
|
* a curated set of native HTML tags verified to carry no implicit role
|
|
19
19
|
* (see ROLELESS_NATIVE_TAGS below), or any autonomous custom element (a
|
|
20
20
|
* hyphenated, author-defined tag per the Custom Elements spec; see
|
|
21
|
-
* isRolelessCustomElementTag below)
|
|
21
|
+
* isRolelessCustomElementTag below). In both cases, only elements that
|
|
22
22
|
* also carry aria-label or aria-labelledby.
|
|
23
23
|
* @expectation
|
|
24
24
|
* Prohibited attributes must not be present on (a); for (b), the naming
|
|
25
25
|
* attribute is at best unreliable (nothing accessible-name-aware to hang
|
|
26
|
-
* it off) and at worst silently ignored by assistive technology
|
|
26
|
+
* it off) and at worst silently ignored by assistive technology. See the
|
|
27
27
|
* roleless-branch implementation note below for the confidence split
|
|
28
28
|
* this produces.
|
|
29
29
|
* @implementation-notes
|
|
30
|
-
* -
|
|
30
|
+
* - Scoped to the single, well-established prohibition class
|
|
31
31
|
* (naming attributes on pure text-semantics roles) rather than an
|
|
32
32
|
* exhaustive per-role prohibited-attribute table; see
|
|
33
33
|
* src/core/aria-helpers.js file header for this engine's confidence-
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* narrower, unambiguous naming-prohibition case fires as a hard,
|
|
42
42
|
* WCAG-normative fail instead, matching this engine's "one rule = one
|
|
43
43
|
* normative decision" pattern.
|
|
44
|
-
* -
|
|
44
|
+
* - Excludes `definition`/`term` on purpose, despite both appearing on
|
|
45
45
|
* MDN's aria-label "not supported" list: both support name from author
|
|
46
46
|
* (`nameFrom: ['author']` for definition, `['author', 'contents']` for
|
|
47
47
|
* term), and the W3C spec's §5.2.8.4 "Roles Supporting Name From Author"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
* property, while engine-level hidden-subtree filtering still applies
|
|
51
51
|
* unless engineOptions.includeHiddenElements is true.
|
|
52
52
|
* - Second, independent branch: naming attributes on ROLELESS elements (no
|
|
53
|
-
* explicit role="", no implicit/native role either)
|
|
53
|
+
* explicit role="", no implicit/native role either), e.g. icon-only
|
|
54
54
|
* `<span aria-label="...">` tiles with no other accessible-name source.
|
|
55
|
-
* ROLELESS_NATIVE_TAGS below is a curated,
|
|
55
|
+
* ROLELESS_NATIVE_TAGS below is a curated, intentionally conservative
|
|
56
56
|
* list of native tags confirmed to carry no implicit role (common
|
|
57
57
|
* text-level tags like `<p>`/`<strong>`/`<em>`/`<code>`/`<mark>`/`<time>`
|
|
58
58
|
* resolve to role `null`, same as a bare `<div>`/`<span>`);
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
* already produces a non-empty accessible name from its content (via
|
|
66
66
|
* `helpers.getContentNameInfo`, same as
|
|
67
67
|
* link-name-present/button-name-present), the naming attribute might
|
|
68
|
-
* just be a redundant/intentional override
|
|
68
|
+
* just be a redundant/intentional override, so it's reported as `cantTell`, not
|
|
69
69
|
* a hard fail. Only a roleless element with no other accessible-name
|
|
70
70
|
* source at all is a confident, deterministic `fail`. The
|
|
71
71
|
* widget-ancestor exemption (skip when the closest real ancestor role is
|
|
@@ -119,8 +119,8 @@ function runInPage(ctx) {
|
|
|
119
119
|
// Roles whose WAI-ARIA 1.2 definition lists a "Prohibited ARIA States and
|
|
120
120
|
// Properties" entry for naming attributes (these roles must never carry an
|
|
121
121
|
// accessible name). Declared inside runInPage (rather than at module
|
|
122
|
-
// scope) because the build inlines only this function's own source text
|
|
123
|
-
//
|
|
122
|
+
// scope) because the build inlines only this function's own source text.
|
|
123
|
+
// See scripts/build-core.js header ("runInPage MUST be self-contained").
|
|
124
124
|
const ROLES_PROHIBITING_NAME = new Set([
|
|
125
125
|
'caption',
|
|
126
126
|
'code',
|
|
@@ -190,7 +190,7 @@ function runInPage(ctx) {
|
|
|
190
190
|
// and how ROLELESS_NATIVE_TAGS/WIDGET_TYPE_ROLES were derived) ---
|
|
191
191
|
|
|
192
192
|
// Small, curated set of native tags verified to carry no explicit or
|
|
193
|
-
// implicit ARIA role.
|
|
193
|
+
// implicit ARIA role. Excludes <section>/<form>/<a>, which are
|
|
194
194
|
// conditionally roleless too, but already handled with more nuance
|
|
195
195
|
// elsewhere in this engine (see header comment).
|
|
196
196
|
const ROLELESS_NATIVE_TAGS = new Set([
|
|
@@ -268,7 +268,7 @@ function runInPage(ctx) {
|
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
// Nearest ancestor's real role (explicit-if-valid, else native/implicit),
|
|
271
|
-
// skipping roleless/presentation/none ancestors
|
|
271
|
+
// skipping roleless/presentation/none ancestors. Used only to check
|
|
272
272
|
// whether that role is a "widget"-type one (the roleless-branch
|
|
273
273
|
// exemption). Not the same helper as aria-required-parent's containment
|
|
274
274
|
// walk: this one also accepts non-required-context roles.
|
|
@@ -296,7 +296,7 @@ function runInPage(ctx) {
|
|
|
296
296
|
|
|
297
297
|
// A small, spec-reserved set of hyphenated tag names that are NOT
|
|
298
298
|
// autonomous custom elements despite containing a hyphen (legacy SVG/
|
|
299
|
-
// MathML tags predating the Custom Elements spec)
|
|
299
|
+
// MathML tags predating the Custom Elements spec). See
|
|
300
300
|
// https://html.spec.whatwg.org/#valid-custom-element-name's own
|
|
301
301
|
// exclusion list. Excluded so this doesn't misclassify them as
|
|
302
302
|
// always-roleless the same way a real custom element is.
|
|
@@ -336,8 +336,8 @@ function runInPage(ctx) {
|
|
|
336
336
|
const tag = String(el.tagName || '').toLowerCase();
|
|
337
337
|
if (!ROLELESS_NATIVE_TAGS.has(tag) && !isRolelessCustomElementTag(tag)) continue;
|
|
338
338
|
const explicitRole = ariaHelpers.getExplicitRole(el);
|
|
339
|
-
if (explicitRole && ariaHelpers.isValidConcreteRole(explicitRole)) continue; // has a real, recognized role
|
|
340
|
-
if (ariaHelpers.getNativeRoleForElement(el)) continue; // has a real implicit role after all
|
|
339
|
+
if (explicitRole && ariaHelpers.isValidConcreteRole(explicitRole)) continue; // has a real, recognized role: Tier 1's concern (if in ROLES_PROHIBITING_NAME) or a role this rule has no opinion on. An INVALID role token (e.g. a typo) is ignored per spec, same as no role attribute at all, and must still fall through to this branch.
|
|
340
|
+
if (ariaHelpers.getNativeRoleForElement(el)) continue; // has a real implicit role after all, not this branch's concern
|
|
341
341
|
|
|
342
342
|
const present = [];
|
|
343
343
|
for (const attr of PROHIBITED_NAMING_ATTRS) {
|
|
@@ -349,7 +349,7 @@ function runInPage(ctx) {
|
|
|
349
349
|
applicableCount += 1;
|
|
350
350
|
|
|
351
351
|
const ancestorRole = getNearestAncestorRole(el);
|
|
352
|
-
if (ancestorRole && WIDGET_TYPE_ROLES.has(ancestorRole)) continue; // roleless helper node inside a real widget
|
|
352
|
+
if (ancestorRole && WIDGET_TYPE_ROLES.has(ancestorRole)) continue; // roleless helper node inside a real widget, not flagged
|
|
353
353
|
|
|
354
354
|
const nameInfo = helpers.getContentNameInfo ? helpers.getContentNameInfo(el, ctx) : null;
|
|
355
355
|
const hasContentFallback = !!(
|
|
@@ -363,7 +363,7 @@ function runInPage(ctx) {
|
|
|
363
363
|
cantTellOccurrences.push(
|
|
364
364
|
helpers.reportOccurrence(el, {
|
|
365
365
|
occurrenceOutcome: 'cantTell',
|
|
366
|
-
summary: `This ${tag} has no role, so ${attr} may not be exposed as its accessible name by assistive technology
|
|
366
|
+
summary: `This ${tag} has no role, so ${attr} may not be exposed as its accessible name by assistive technology, but the element's own content already provides one.`,
|
|
367
367
|
hint: 'Verify whether the existing text content already serves as this element’s label; if so the naming attribute is redundant, otherwise give the element a role that supports naming (e.g. role="img").',
|
|
368
368
|
i18n: {
|
|
369
369
|
summaryKey: 'ariaProhibitedAttr_summary_cantTell_roleless',
|
|
@@ -411,7 +411,7 @@ function runInPage(ctx) {
|
|
|
411
411
|
|
|
412
412
|
// See helpers.resolveTieredOutcome's own header comment (src/core/dom-helpers.js):
|
|
413
413
|
// a fail-tier finding never silently discards cantTell-tier findings from
|
|
414
|
-
// the same run
|
|
414
|
+
// the same run. Both are returned together when the outcome is 'fail'.
|
|
415
415
|
const resolved = helpers.resolveTieredOutcome(
|
|
416
416
|
failOccurrences,
|
|
417
417
|
cantTellOccurrences,
|