pour-engine 1.37.0 → 1.37.1
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/config/project.config.js +1 -1
- package/engine/COVERAGE.md +1 -1
- package/engine/README.md +1 -1
- package/engine/lib/contrast.js +3 -26
- package/engine/lib/dom.js +6 -0
- package/engine/lib/roles.js +6 -0
- package/engine/rules/best-practice/landmark-top-level.js +1 -5
- package/engine/rules/best-practice/landmark-unique.js +2 -5
- package/engine/rules/wcag/1.3.1-definition-list.js +7 -8
- package/engine/rules/wcag/1.3.1-list-structure.js +2 -5
- package/engine/rules/wcag/2.4.1-bypass-blocks.js +1 -2
- package/package.json +1 -1
package/config/project.config.js
CHANGED
package/engine/COVERAGE.md
CHANGED
|
@@ -111,7 +111,7 @@ meaning that only a person can settle, even where a rule decides most real pages
|
|
|
111
111
|
|
|
112
112
|
| SC | Name | Level | Coverage | Rules |
|
|
113
113
|
|---|---|---|---|---|
|
|
114
|
-
| 4.1.2 | [Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | A | Partially automated | input-image-alt, form-label, link-name, aria-allowed-attr, aria-attr-valid, aria-field-name, aria-hidden-focus, aria-label-misuse, aria-valid-refs, button-name, composite-widget-name, dialog-name, frame-title, label-for-valid, nested-interactive, role-required-aria, summary-name, valid-role
|
|
114
|
+
| 4.1.2 | [Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | A | Partially automated | input-image-alt, form-label, link-name, aria-allowed-attr, aria-attr-valid, aria-field-name, aria-hidden-focus, aria-label-misuse, aria-valid-refs, button-name, composite-widget-name, dialog-name, frame-title, invoker-target, label-for-valid, nested-interactive, role-required-aria, summary-name, valid-role |
|
|
115
115
|
| 4.1.3 | [Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | AA | Manual review | — |
|
|
116
116
|
|
|
117
117
|
**Totals:** 39 partially automated · 47 manual — with 88 rules.
|
package/engine/README.md
CHANGED
|
@@ -112,7 +112,7 @@ Nothing in the spec is silently skipped — that claim is the product.
|
|
|
112
112
|
|
|
113
113
|
## Honest current state
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
88 rules, hardened on real sites and the `testbeds/` pages. Audits walk into
|
|
116
116
|
open shadow roots (targets come back as `host >>> inner` selector chains);
|
|
117
117
|
iframe traversal is the host's job, and the extension does it. Known gaps:
|
|
118
118
|
the full accname spec (ours is a close approximation) and the language
|
package/engine/lib/contrast.js
CHANGED
|
@@ -1040,7 +1040,7 @@ export function viewportVeil(doc) {
|
|
|
1040
1040
|
/** Parse a computed text-shadow list into layers. Computed style serializes
|
|
1041
1041
|
* the colour first ("rgb(0, 0, 0) 1px 0px 2px") with px lengths; author-ish
|
|
1042
1042
|
* orderings are tolerated. */
|
|
1043
|
-
|
|
1043
|
+
function parseTextShadows(cssText) {
|
|
1044
1044
|
if (!cssText || cssText === 'none') return [];
|
|
1045
1045
|
const layers = [];
|
|
1046
1046
|
for (const part of cssText.split(/,(?![^(]*\))/)) {
|
|
@@ -1116,7 +1116,7 @@ export function textShadowNegligible(cssText, fontSize) {
|
|
|
1116
1116
|
* uncertain path keeps the FULL box, erring toward review, never past a
|
|
1117
1117
|
* real overlap. Returns null when the clip leaves nothing paintable.
|
|
1118
1118
|
*/
|
|
1119
|
-
|
|
1119
|
+
function paintableRect(element, rect) {
|
|
1120
1120
|
let { left, top, right, bottom } = rect;
|
|
1121
1121
|
let mode = getComputedStyle(element).position;
|
|
1122
1122
|
for (let a = element.parentElement; a; a = a.parentElement) {
|
|
@@ -1333,7 +1333,7 @@ export function imageLuminanceRange(url, overlays = [], grid = null) {
|
|
|
1333
1333
|
* cover/contain hands sizing to an intrinsic this function does not have, or
|
|
1334
1334
|
* when its position is not a plain length or percentage.
|
|
1335
1335
|
*/
|
|
1336
|
-
|
|
1336
|
+
function backgroundImagePaintRects(element) {
|
|
1337
1337
|
const style = getComputedStyle(element);
|
|
1338
1338
|
const images = splitLayers(style.backgroundImage);
|
|
1339
1339
|
if (!images.length) return [];
|
|
@@ -1492,29 +1492,6 @@ export function rangeWithBackdrop(range, under, overlays = []) {
|
|
|
1492
1492
|
};
|
|
1493
1493
|
}
|
|
1494
1494
|
|
|
1495
|
-
/**
|
|
1496
|
-
* Luminance range of a CSS gradient, from its colour stops. Interpolated
|
|
1497
|
-
* colours stay close enough to their stops' luminances to bracket.
|
|
1498
|
-
*/
|
|
1499
|
-
export function gradientLuminanceRange(backgroundImageCss, overlays = []) {
|
|
1500
|
-
const stops = (backgroundImageCss.match(/rgba?\([^)]+\)/g) ?? []).map(parseColor).filter(Boolean);
|
|
1501
|
-
if (!stops.length || stops.some((c) => c.a < 1)) return null; // translucent stops reveal what's beneath
|
|
1502
|
-
const composited = stops.map((stop) => (overlays.length ? applyOverlays(stop, overlays) : stop));
|
|
1503
|
-
const lums = composited.map(luminance);
|
|
1504
|
-
const min = Math.min(...lums);
|
|
1505
|
-
const max = Math.max(...lums);
|
|
1506
|
-
// The COLOURS at the extremes, not just their luminances: translucent text
|
|
1507
|
-
// takes its presented colour from the pixels beneath, so bracketing that
|
|
1508
|
-
// blend needs the actual rgb to composite against, and luminance alone
|
|
1509
|
-
// cannot be un-gamma'd back into one.
|
|
1510
|
-
return {
|
|
1511
|
-
min,
|
|
1512
|
-
max,
|
|
1513
|
-
minColor: composited[lums.indexOf(min)],
|
|
1514
|
-
maxColor: composited[lums.indexOf(max)],
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
1495
|
/** The layers of a computed background-image list, split on top-level
|
|
1519
1496
|
* commas only: commas inside url() and gradient() belong to the layer. */
|
|
1520
1497
|
export function splitBackgroundLayers(backgroundImageCss) {
|
package/engine/lib/dom.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// DOM helpers shared by all rules.
|
|
2
2
|
|
|
3
|
+
/** Elements that never reach the accessibility tree, so they cannot break
|
|
4
|
+
* the structure of a list or a description list. STYLE belongs with them:
|
|
5
|
+
* CSS-in-JS libraries inject <style> right beside the markup, and it was
|
|
6
|
+
* being counted as a stray child that broke the list. */
|
|
7
|
+
export const NEVER_RENDERED = new Set(['SCRIPT', 'TEMPLATE', 'STYLE', 'LINK', 'META']);
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* The audit context plus every OPEN shadow root beneath it, hosts before
|
|
5
11
|
* their shadow trees. Collected once per audit so each rule can query every
|
package/engine/lib/roles.js
CHANGED
|
@@ -24,6 +24,12 @@ export const GLOBAL_ARIA = new Set([
|
|
|
24
24
|
'live', 'owns', 'relevant', 'roledescription', 'braillelabel', 'brailleroledescription',
|
|
25
25
|
]);
|
|
26
26
|
|
|
27
|
+
/** The eight landmark roles (ARIA 1.2, Landmark Roles). Shared by the
|
|
28
|
+
* landmark rules, the landmark lens and the screen reader's rotor. */
|
|
29
|
+
export const LANDMARK_ROLES = new Set([
|
|
30
|
+
'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'region', 'search',
|
|
31
|
+
]);
|
|
32
|
+
|
|
27
33
|
/** Attributes each role supports IN ADDITION to the globals.
|
|
28
34
|
*
|
|
29
35
|
* Includes the four attributes ARIA 1.2 removed from the GLOBAL set
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
// page outline. Complementary joins via the aside demotion semantics in
|
|
4
4
|
// lib/roles.js: only an aside that actually reaches the accessibility tree
|
|
5
5
|
// as complementary owes top-levelness.
|
|
6
|
-
import { implicitRole } from '../../lib/roles.js';
|
|
7
|
-
|
|
8
|
-
const LANDMARK_ROLES = new Set([
|
|
9
|
-
'main', 'navigation', 'banner', 'contentinfo', 'complementary', 'region', 'search', 'form',
|
|
10
|
-
]);
|
|
6
|
+
import { implicitRole, LANDMARK_ROLES } from '../../lib/roles.js';
|
|
11
7
|
|
|
12
8
|
/** HTML-AAM (form, section): "If a form has no accessible name, do not
|
|
13
9
|
* expose the element as a landmark", and a section is a region only with
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// ARIA APG landmark pattern: same-type landmarks need distinguishing
|
|
2
2
|
// labels, and banner / contentinfo / main must be unique per page outright
|
|
3
3
|
// (two "banners" are ambiguous however well they're labelled).
|
|
4
|
-
import { implicitRole } from '../../lib/roles.js';
|
|
4
|
+
import { implicitRole, LANDMARK_ROLES } from '../../lib/roles.js';
|
|
5
5
|
import { labelledByName } from '../../lib/accessible-name.js';
|
|
6
6
|
|
|
7
7
|
const SINGLETON = new Set(['banner', 'contentinfo', 'main']);
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// Only the eight ARIA landmark roles (lib/roles.js) count. An explicit
|
|
10
10
|
// non-landmark role on a landmark element (<nav role="menubar">) makes it a
|
|
11
11
|
// widget, not a landmark, so it has nothing to be distinguished from
|
|
12
12
|
// (2026-08-25 overnight audit).
|
|
13
|
-
const LANDMARK_ROLES = new Set([
|
|
14
|
-
'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'region', 'search',
|
|
15
|
-
]);
|
|
16
13
|
|
|
17
14
|
/** Landmark role of the element in the accessibility tree — explicit role
|
|
18
15
|
* first, else the implicit role (which handles header/footer demotion
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// WCAG SC 1.3.1 Info and Relationships (Level A)
|
|
2
|
+
import { NEVER_RENDERED } from '../../lib/dom.js';
|
|
3
|
+
|
|
2
4
|
const ALLOWED = new Set(['DT', 'DD', 'DIV']);
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// determine, and every dt/dd pair stays intact around an element that has
|
|
9
|
-
// no tree presence (2026-08-25 overnight audit).
|
|
10
|
-
const NEVER_RENDERED = new Set(['SCRIPT', 'TEMPLATE', 'STYLE', 'LINK', 'META']);
|
|
5
|
+
// NEVER_RENDERED cannot corrupt the term/description pairing: HTML's content
|
|
6
|
+
// model does exclude style from dl, but validity is not the criterion;
|
|
7
|
+
// 1.3.1 is about relationships assistive technology can determine, and
|
|
8
|
+
// every dt/dd pair stays intact around an element that has no tree
|
|
9
|
+
// presence (2026-08-25 overnight audit).
|
|
11
10
|
|
|
12
11
|
export default {
|
|
13
12
|
id: 'definition-list',
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// WCAG SC 1.3.1 Info and Relationships (Level A)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// <style> right where the markup sits, and it was being counted as a stray
|
|
5
|
-
// child that broke the list.
|
|
6
|
-
const NEVER_RENDERED = new Set(['SCRIPT', 'TEMPLATE', 'STYLE', 'LINK', 'META']);
|
|
2
|
+
import { NEVER_RENDERED } from '../../lib/dom.js';
|
|
3
|
+
|
|
7
4
|
const ITEM_ROLES = ['listitem', 'presentation', 'none'];
|
|
8
5
|
|
|
9
6
|
export default {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// WCAG SC 2.4.1 Bypass Blocks (Level A)
|
|
2
2
|
import { collectRoots, isEmbeddedDocument } from '../../lib/dom.js';
|
|
3
|
-
import { effectiveRole } from '../../lib/roles.js';
|
|
3
|
+
import { effectiveRole, LANDMARK_ROLES } from '../../lib/roles.js';
|
|
4
4
|
|
|
5
5
|
// ARIA11 lists the landmark roles: banner, complementary, contentinfo,
|
|
6
6
|
// form, main, navigation, region, search. Judged by EFFECTIVE role, not tag
|
|
@@ -10,7 +10,6 @@ import { effectiveRole } from '../../lib/roles.js';
|
|
|
10
10
|
// and missed the second. region and form are landmarks only when named
|
|
11
11
|
// (ARIA 1.2 requires an accessible name for region; HTML-AAM maps form to
|
|
12
12
|
// the form landmark only with one), so the name is checked here.
|
|
13
|
-
const LANDMARK_ROLES = new Set(['banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'region', 'search']);
|
|
14
13
|
const NAMED_ONLY = new Set(['form', 'region']);
|
|
15
14
|
const LANDMARK_CANDIDATES = 'main, header, footer, nav, aside, section, form, [role]';
|
|
16
15
|
const hasName = (el) => Boolean(
|
package/package.json
CHANGED