@surea11y/core 1.4.0 → 1.5.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +88 -7
  2. package/README.md +19 -3
  3. package/bin/surea11y-core.js +0 -0
  4. package/docs/API_STABILITY.md +2 -2
  5. package/docs/ARIA_DEPRECATION.md +95 -0
  6. package/docs/ENGINE_OPTIONS.md +14 -10
  7. package/docs/I18N.md +176 -20
  8. package/docs/INTEGRATION.md +28 -6
  9. package/docs/LIMITATIONS.md +1 -1
  10. package/docs/OUTPUT_SCHEMA.md +13 -3
  11. package/docs/REPORT.md +2 -0
  12. package/docs/RULE_AUTHORING.md +53 -0
  13. package/docs/RULE_CATALOG.md +6 -6
  14. package/docs/TROUBLESHOOTING.md +2 -2
  15. package/package.json +8 -1
  16. package/src/checks/automatic/aria-allowed-attr.js +661 -99
  17. package/src/checks/automatic/aria-allowed-role.js +14 -16
  18. package/src/checks/automatic/aria-braille-equivalent.js +17 -19
  19. package/src/checks/automatic/aria-conditional-attr.js +17 -19
  20. package/src/checks/automatic/aria-deprecated-role.js +122 -41
  21. package/src/checks/automatic/aria-hidden-body.js +2 -9
  22. package/src/checks/automatic/aria-hidden-focus.js +99 -18
  23. package/src/checks/automatic/aria-prohibited-attr.js +54 -55
  24. package/src/checks/automatic/aria-prohibited-children.js +26 -26
  25. package/src/checks/automatic/aria-required-attr.js +14 -17
  26. package/src/checks/automatic/aria-required-children.js +17 -20
  27. package/src/checks/automatic/aria-required-parent.js +17 -20
  28. package/src/checks/automatic/aria-roles-valid.js +66 -27
  29. package/src/checks/automatic/aria-valid-attr-value.js +18 -21
  30. package/src/checks/automatic/aria-valid-attr.js +14 -17
  31. package/src/checks/automatic/autocomplete-valid.js +52 -18
  32. package/src/checks/automatic/avoid-inline-spacing.js +192 -34
  33. package/src/checks/automatic/binary-control-name-present.js +30 -24
  34. package/src/checks/automatic/button-name-present.js +73 -45
  35. package/src/checks/automatic/canvas-text-alternative-present.js +15 -8
  36. package/src/checks/automatic/combobox-name-present.js +23 -18
  37. package/src/checks/automatic/css-orientation-lock.js +22 -22
  38. package/src/checks/automatic/definition-list-children-valid.js +18 -21
  39. package/src/checks/automatic/deprecated-elements-not-used.js +14 -16
  40. package/src/checks/automatic/dialog-name-present.js +24 -19
  41. package/src/checks/automatic/dlitem-parent-valid.js +15 -17
  42. package/src/checks/automatic/duplicate-id-aria.js +45 -37
  43. package/src/checks/automatic/form-control-programmatic-label-present.js +48 -4
  44. package/src/checks/automatic/form-control-single-label.js +109 -43
  45. package/src/checks/automatic/html-xml-lang-mismatch.js +2 -9
  46. package/src/checks/automatic/iframe-focusable-content.js +29 -31
  47. package/src/checks/automatic/iframe-name-present.js +15 -17
  48. package/src/checks/automatic/iframe-title-unique.js +18 -23
  49. package/src/checks/automatic/img-alt-present.js +16 -9
  50. package/src/checks/automatic/input-image-alt-present.js +99 -48
  51. package/src/checks/automatic/label-in-name.js +102 -33
  52. package/src/checks/automatic/language-page-present.js +5 -1
  53. package/src/checks/automatic/link-in-text-block.js +19 -21
  54. package/src/checks/automatic/link-name-present.js +75 -47
  55. package/src/checks/automatic/list-children-valid.js +15 -17
  56. package/src/checks/automatic/listbox-name-present.js +23 -18
  57. package/src/checks/automatic/listitem-parent-valid.js +14 -17
  58. package/src/checks/automatic/menuitem-name-present.js +24 -19
  59. package/src/checks/automatic/meta-refresh-no-exceptions.js +44 -18
  60. package/src/checks/automatic/meta-refresh-timing-absent.js +44 -21
  61. package/src/checks/automatic/meta-viewport-zoom-enabled.js +51 -32
  62. package/src/checks/automatic/meter-name-present.js +24 -19
  63. package/src/checks/automatic/nested-interactive-controls-absent.js +179 -51
  64. package/src/checks/automatic/object-text-alternative-present.js +14 -7
  65. package/src/checks/automatic/option-name-present.js +24 -19
  66. package/src/checks/automatic/progressbar-name-present.js +27 -22
  67. package/src/checks/automatic/searchbox-name-present.js +27 -18
  68. package/src/checks/automatic/server-side-image-map-absent.js +15 -18
  69. package/src/checks/automatic/slider-name-present.js +26 -19
  70. package/src/checks/automatic/spinbutton-name-present.js +27 -18
  71. package/src/checks/automatic/summary-name-present.js +24 -19
  72. package/src/checks/automatic/tab-name-present.js +24 -19
  73. package/src/checks/automatic/table-headers-attr-valid.js +15 -17
  74. package/src/checks/automatic/table-th-has-data-cells.js +82 -25
  75. package/src/checks/automatic/target-size-minimum.js +104 -81
  76. package/src/checks/automatic/td-has-header.js +15 -20
  77. package/src/checks/automatic/textbox-name-present.js +23 -18
  78. package/src/checks/automatic/tooltip-name-present.js +24 -19
  79. package/src/checks/automatic/treeitem-name-present.js +24 -19
  80. package/src/checks/automatic/valid-lang.js +31 -20
  81. package/src/checks/manual/accesskeys-manual.js +18 -19
  82. package/src/checks/manual/aria-checked-state-mismatch-manual.js +19 -22
  83. package/src/checks/{automatic/bypass-blocks-present.js → manual/bypass-blocks-present-manual.js} +98 -44
  84. package/src/checks/manual/empty-heading-manual.js +15 -17
  85. package/src/checks/manual/empty-table-header-manual.js +27 -30
  86. package/src/checks/manual/form-control-programmatic-label-quality-manual.js +2 -9
  87. package/src/checks/manual/heading-order-manual.js +17 -22
  88. package/src/checks/manual/image-redundant-alt-manual.js +14 -17
  89. package/src/checks/manual/input-image-alt-decorative-manual.js +24 -0
  90. package/src/checks/manual/label-title-only-manual.js +15 -17
  91. package/src/checks/manual/landmark-banner-is-top-level-manual.js +25 -39
  92. package/src/checks/manual/landmark-contentinfo-is-top-level-manual.js +21 -27
  93. package/src/checks/manual/landmark-main-is-top-level-manual.js +14 -17
  94. package/src/checks/manual/landmark-no-duplicate-banner-manual.js +2 -7
  95. package/src/checks/manual/landmark-no-duplicate-contentinfo-manual.js +2 -7
  96. package/src/checks/manual/landmark-no-duplicate-main-manual.js +2 -7
  97. package/src/checks/manual/landmark-one-main-manual.js +2 -9
  98. package/src/checks/manual/landmark-unique-manual.js +22 -27
  99. package/src/checks/manual/link-name-quality-manual.js +15 -17
  100. package/src/checks/manual/meta-viewport-large-manual.js +14 -17
  101. package/src/checks/manual/mouse-only-event-handlers-manual.js +17 -19
  102. package/src/checks/manual/page-has-heading-one-manual.js +2 -9
  103. package/src/checks/manual/presentation-role-conflict-manual.js +19 -21
  104. package/src/checks/manual/region-manual.js +13 -6
  105. package/src/checks/manual/scope-attr-valid-manual.js +14 -17
  106. package/src/checks/manual/skip-link-manual.js +39 -47
  107. package/src/checks/manual/tabindex-manual.js +14 -17
  108. package/src/checks/manual/table-duplicate-name-manual.js +14 -17
  109. package/src/core.js +8818 -4330
  110. package/src/report.js +14 -0
  111. package/src/sarif.js +2 -2
  112. package/surea11y.browser.js +4023 -3911
  113. package/surea11y.i18n.de.js +22 -0
  114. package/surea11y.i18n.es.js +22 -0
  115. package/surea11y.i18n.fr.js +22 -0
@@ -184,59 +184,51 @@ function runInPage(ctx) {
184
184
  const unusableByGeometry = !!geometryReasonCode;
185
185
  if (!unusableByAcc && !unusableByGeometry) continue;
186
186
 
187
- const stableSelector = helpers.buildSelector ? helpers.buildSelector(el) : 'html';
188
- const html = helpers.getOuterHtmlSnippet
189
- ? helpers.getOuterHtmlSnippet(el)
190
- : el.outerHTML || '';
187
+ occurrences.push(
188
+ helpers.reportOccurrence(el, {
189
+ summary: 'This skip link points to a target that exists but is not currently usable.',
190
+ hint: 'Point this skip link to a target that is exposed and usable as a navigation destination.',
191
+ i18n: {
192
+ summaryKey: 'skipLink_summary_unusableTarget_cantTell',
193
+ hintKey: 'skipLink_hint_unusableTarget_cantTell',
194
+ params: { href }
195
+ },
196
+ data: {
197
+ details: {
198
+ reasonCode: 'SKIP_LINK_TARGET_UNUSABLE',
199
+ href,
200
+ unusableReasonCode: unusableByAcc ? 'ACC_TREE_INELIGIBLE' : geometryReasonCode,
201
+ targetSelector: helpers.buildSelector ? helpers.buildSelector(target) : null,
202
+ geometryCheckEnabled: geometrySupported
203
+ },
204
+ visibilityFilter: {
205
+ targetSet: 'acc',
206
+ accEligible: accEligibility.eligible,
207
+ reasons: accEligibility.reasons
208
+ },
209
+ targetGeometry: geometryEligibility
210
+ ? { eligible: geometryEligibility.eligible, reasons: geometryEligibility.reasons }
211
+ : { eligible: null, reasons: [] }
212
+ }
213
+ })
214
+ );
215
+ continue;
216
+ }
191
217
 
192
- occurrences.push({
193
- selector: stableSelector,
194
- html,
195
- summary: 'This skip link points to a target that exists but is not currently usable.',
196
- hint: 'Point this skip link to a target that is exposed and usable as a navigation destination.',
218
+ occurrences.push(
219
+ helpers.reportOccurrence(el, {
220
+ summary: "This skip link's target does not exist.",
221
+ hint: "Point the skip link's href at an id that exists in the document, or add the missing target element.",
197
222
  i18n: {
198
- summaryKey: 'skipLink_summary_unusableTarget_cantTell',
199
- hintKey: 'skipLink_hint_unusableTarget_cantTell',
223
+ summaryKey: 'skipLink_summary_cantTell',
224
+ hintKey: 'skipLink_hint_cantTell',
200
225
  params: { href }
201
226
  },
202
227
  data: {
203
- details: {
204
- reasonCode: 'SKIP_LINK_TARGET_UNUSABLE',
205
- href,
206
- unusableReasonCode: unusableByAcc ? 'ACC_TREE_INELIGIBLE' : geometryReasonCode,
207
- targetSelector: helpers.buildSelector ? helpers.buildSelector(target) : null,
208
- geometryCheckEnabled: geometrySupported
209
- },
210
- visibilityFilter: {
211
- targetSet: 'acc',
212
- accEligible: accEligibility.eligible,
213
- reasons: accEligibility.reasons
214
- },
215
- targetGeometry: geometryEligibility
216
- ? { eligible: geometryEligibility.eligible, reasons: geometryEligibility.reasons }
217
- : { eligible: null, reasons: [] }
228
+ details: { reasonCode: 'SKIP_LINK_TARGET_MISSING', href }
218
229
  }
219
- });
220
- continue;
221
- }
222
-
223
- const stableSelector = helpers.buildSelector ? helpers.buildSelector(el) : 'html';
224
- const html = helpers.getOuterHtmlSnippet ? helpers.getOuterHtmlSnippet(el) : el.outerHTML || '';
225
-
226
- occurrences.push({
227
- selector: stableSelector,
228
- html,
229
- summary: "This skip link's target does not exist.",
230
- hint: "Point the skip link's href at an id that exists in the document, or add the missing target element.",
231
- i18n: {
232
- summaryKey: 'skipLink_summary_cantTell',
233
- hintKey: 'skipLink_hint_cantTell',
234
- params: { href }
235
- },
236
- data: {
237
- details: { reasonCode: 'SKIP_LINK_TARGET_MISSING', href }
238
- }
239
- });
230
+ })
231
+ );
240
232
  }
241
233
 
242
234
  if (applicableCount === 0) {
@@ -62,23 +62,20 @@ function runInPage(ctx) {
62
62
 
63
63
  if (n <= 0) continue;
64
64
 
65
- const stableSelector = helpers.buildSelector ? helpers.buildSelector(el) : 'html';
66
- const html = helpers.getOuterHtmlSnippet ? helpers.getOuterHtmlSnippet(el) : el.outerHTML || '';
67
-
68
- occurrences.push({
69
- selector: stableSelector,
70
- html,
71
- summary: 'This element has a positive tabindex, overriding the natural tab order.',
72
- hint: 'Use tabindex="0" (or a negative value to remove from tab order) instead of a positive number; fix the DOM order if a different tab order is needed.',
73
- i18n: {
74
- summaryKey: 'tabindex_summary_cantTell',
75
- hintKey: 'tabindex_hint_cantTell',
76
- params: { value: String(n) }
77
- },
78
- data: {
79
- details: { reasonCode: 'TABINDEX_POSITIVE', value: n }
80
- }
81
- });
65
+ occurrences.push(
66
+ helpers.reportOccurrence(el, {
67
+ summary: 'This element has a positive tabindex, overriding the natural tab order.',
68
+ hint: 'Use tabindex="0" (or a negative value to remove from tab order) instead of a positive number; fix the DOM order if a different tab order is needed.',
69
+ i18n: {
70
+ summaryKey: 'tabindex_summary_cantTell',
71
+ hintKey: 'tabindex_hint_cantTell',
72
+ params: { value: String(n) }
73
+ },
74
+ data: {
75
+ details: { reasonCode: 'TABINDEX_POSITIVE', value: n }
76
+ }
77
+ })
78
+ );
82
79
  }
83
80
 
84
81
  if (applicableCount === 0) {
@@ -73,23 +73,20 @@ function runInPage(ctx) {
73
73
 
74
74
  if (captionText.toLowerCase() !== summary.toLowerCase()) continue;
75
75
 
76
- const stableSelector = helpers.buildSelector ? helpers.buildSelector(el) : 'html';
77
- const html = helpers.getOuterHtmlSnippet ? helpers.getOuterHtmlSnippet(el) : el.outerHTML || '';
78
-
79
- occurrences.push({
80
- selector: stableSelector,
81
- html,
82
- summary: "This table's caption duplicates its summary attribute.",
83
- hint: 'Remove the redundant summary attribute, or make it provide different information than the caption.',
84
- i18n: {
85
- summaryKey: 'tableDuplicateName_summary_cantTell',
86
- hintKey: 'tableDuplicateName_hint_cantTell',
87
- params: {}
88
- },
89
- data: {
90
- details: { reasonCode: 'TABLE_CAPTION_SUMMARY_DUPLICATE' }
91
- }
92
- });
76
+ occurrences.push(
77
+ helpers.reportOccurrence(el, {
78
+ summary: "This table's caption duplicates its summary attribute.",
79
+ hint: 'Remove the redundant summary attribute, or make it provide different information than the caption.',
80
+ i18n: {
81
+ summaryKey: 'tableDuplicateName_summary_cantTell',
82
+ hintKey: 'tableDuplicateName_hint_cantTell',
83
+ params: {}
84
+ },
85
+ data: {
86
+ details: { reasonCode: 'TABLE_CAPTION_SUMMARY_DUPLICATE' }
87
+ }
88
+ })
89
+ );
93
90
  }
94
91
 
95
92
  if (applicableCount === 0) {