@surea11y/core 1.1.0 → 1.1.2
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 +25 -2
- package/docs/ENGINE_OPTIONS.md +2 -0
- package/docs/LIMITATIONS.md +1 -1
- package/package.json +1 -1
- package/src/checks/automatic/aria-allowed-attr.js +5 -4
- package/src/checks/automatic/aria-allowed-role.js +5 -4
- package/src/checks/automatic/aria-braille-equivalent.js +3 -4
- package/src/checks/automatic/aria-conditional-attr.js +3 -4
- package/src/checks/automatic/aria-deprecated-role.js +2 -3
- package/src/checks/automatic/aria-prohibited-attr.js +5 -4
- package/src/checks/automatic/aria-prohibited-children.js +2 -3
- package/src/checks/automatic/aria-required-attr.js +2 -3
- package/src/checks/automatic/aria-required-children.js +2 -3
- package/src/checks/automatic/aria-required-parent.js +3 -4
- package/src/checks/automatic/aria-roles-valid.js +2 -3
- package/src/checks/automatic/aria-valid-attr-value.js +5 -4
- package/src/checks/automatic/aria-valid-attr.js +5 -4
- package/src/checks/automatic/autocomplete-valid.js +2 -3
- package/src/checks/automatic/avoid-inline-spacing.js +2 -3
- package/src/checks/automatic/binary-control-name-present.js +2 -3
- package/src/checks/automatic/button-name-present.js +14 -4
- package/src/checks/automatic/bypass-blocks-present.js +35 -7
- package/src/checks/automatic/combobox-name-present.js +2 -3
- package/src/checks/automatic/definition-list-children-valid.js +2 -3
- package/src/checks/automatic/deprecated-elements-not-used.js +5 -4
- package/src/checks/automatic/dialog-name-present.js +2 -3
- package/src/checks/automatic/dlitem-parent-valid.js +2 -3
- package/src/checks/automatic/form-control-single-label.js +2 -3
- package/src/checks/automatic/iframe-focusable-content.js +2 -3
- package/src/checks/automatic/iframe-name-present.js +2 -3
- package/src/checks/automatic/iframe-title-unique.js +5 -5
- package/src/checks/automatic/label-in-name.js +7 -8
- package/src/checks/automatic/link-in-text-block.js +2 -3
- package/src/checks/automatic/link-name-present.js +16 -4
- package/src/checks/automatic/list-children-valid.js +2 -3
- package/src/checks/automatic/listbox-name-present.js +2 -3
- package/src/checks/automatic/listitem-parent-valid.js +2 -3
- package/src/checks/automatic/menuitem-name-present.js +2 -3
- package/src/checks/automatic/meter-name-present.js +2 -3
- package/src/checks/automatic/nested-interactive-controls-absent.js +2 -3
- package/src/checks/automatic/option-name-present.js +2 -3
- package/src/checks/automatic/progressbar-name-present.js +2 -3
- package/src/checks/automatic/searchbox-name-present.js +2 -3
- package/src/checks/automatic/server-side-image-map-absent.js +2 -3
- package/src/checks/automatic/slider-name-present.js +2 -3
- package/src/checks/automatic/spinbutton-name-present.js +2 -3
- package/src/checks/automatic/summary-name-present.js +2 -3
- package/src/checks/automatic/tab-name-present.js +2 -3
- package/src/checks/automatic/table-headers-attr-valid.js +5 -4
- package/src/checks/automatic/table-th-has-data-cells.js +5 -4
- package/src/checks/automatic/td-has-header.js +2 -3
- package/src/checks/automatic/textbox-name-present.js +2 -3
- package/src/checks/automatic/tooltip-name-present.js +2 -3
- package/src/checks/automatic/treeitem-name-present.js +2 -3
- package/src/checks/automatic/valid-lang.js +2 -3
- package/src/checks/manual/accesskeys-manual.js +1 -7
- package/src/checks/manual/aria-checked-state-mismatch-manual.js +7 -6
- package/src/checks/manual/aria-text-manual.js +2 -3
- package/src/checks/manual/focus-order-semantics-manual.js +2 -3
- package/src/checks/manual/identical-links-same-purpose-manual.js +2 -3
- package/src/checks/manual/image-redundant-alt-manual.js +2 -3
- package/src/checks/manual/label-title-only-manual.js +2 -3
- package/src/checks/manual/link-name-quality-manual.js +2 -3
- package/src/checks/manual/mouse-only-event-handlers-manual.js +2 -3
- package/src/checks/manual/no-autoplay-audio-manual.js +2 -3
- package/src/checks/manual/p-as-heading-manual.js +2 -3
- package/src/checks/manual/page-has-heading-one-manual.js +31 -2
- package/src/checks/manual/presentation-role-conflict-manual.js +3 -4
- package/src/checks/manual/scrollable-region-focusable-manual.js +2 -3
- package/src/checks/manual/skip-link-manual.js +91 -9
- package/src/checks/manual/table-duplicate-name-manual.js +2 -3
- package/src/checks/manual/table-fake-caption-manual.js +2 -3
- package/src/checks/manual/video-caption-manual.js +2 -3
- package/src/core/dom-helpers.js +89 -3
- package/src/core/dom-runner.js +19 -0
- package/src/core.js +962 -481
- package/src/i18n/en.js +4 -2
- package/src/i18n/fr.js +4 -2
package/src/core/dom-runner.js
CHANGED
|
@@ -48,6 +48,9 @@ function runCore(pageUrl, contextSelector, engineOptions, runOnly, CHECK_DEFS, R
|
|
|
48
48
|
|
|
49
49
|
// Default on: opt OUT with `includeShadowDom: false`, not opt in.
|
|
50
50
|
const includeShadowDom = !(engineOptionsResolved && engineOptionsResolved.includeShadowDom === false);
|
|
51
|
+
// Default off: hidden/collapsed content is excluded from rule evaluation
|
|
52
|
+
// unless the caller explicitly opts in.
|
|
53
|
+
const includeHiddenElements = !!(engineOptionsResolved && engineOptionsResolved.includeHiddenElements === true);
|
|
51
54
|
const excludeSelectors = normalizeSelectorList(engineOptionsResolved && engineOptionsResolved.excludeSelectors);
|
|
52
55
|
|
|
53
56
|
const url = pageUrl || (document.location && document.location.href) || null;
|
|
@@ -58,11 +61,27 @@ function runCore(pageUrl, contextSelector, engineOptions, runOnly, CHECK_DEFS, R
|
|
|
58
61
|
? engineOptionsResolved.timestamp.trim()
|
|
59
62
|
: null;
|
|
60
63
|
|
|
64
|
+
// createDomHelpers()/createContrastHelpers() persist their element-keyed
|
|
65
|
+
// caches (outerHtmlCache, selectorCache, etc.) on window.__a11ycoreSharedCache
|
|
66
|
+
// so multiple helper instances created *within this run* can share them
|
|
67
|
+
// deterministically. But a window/document is frequently reused across
|
|
68
|
+
// SEPARATE runs -- e.g. Jest's jsdom environment creates one window per
|
|
69
|
+
// test file, and mutating document.body between it() blocks is standard.
|
|
70
|
+
// Those caches are keyed by element reference, not content, so a run that
|
|
71
|
+
// reuses an already-cached element (document.body never changes identity)
|
|
72
|
+
// would otherwise read stale data cached by an earlier, unrelated run on
|
|
73
|
+
// the same window. Clearing at the start of every run keeps sharing scoped
|
|
74
|
+
// to "this run" as intended, without leaking across runs.
|
|
75
|
+
try {
|
|
76
|
+
if (window && window.__a11ycoreSharedCache) window.__a11ycoreSharedCache = {};
|
|
77
|
+
} catch {}
|
|
78
|
+
|
|
61
79
|
const sharedHelpers = createDomHelpers({
|
|
62
80
|
document,
|
|
63
81
|
window,
|
|
64
82
|
root: roots,
|
|
65
83
|
includeShadowDom,
|
|
84
|
+
includeHiddenElements,
|
|
66
85
|
excludeSelectors,
|
|
67
86
|
// Optional perf counters (bench/debug only). Deterministic and per-run.
|
|
68
87
|
perfStats: !!(engineOptionsResolved && engineOptionsResolved.perfStats)
|