@kinti/a11y-toolkit 5.26.0 → 5.28.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 (45) hide show
  1. package/README.md +1 -1
  2. package/a11y_toolkit/a11y.py +30 -4
  3. package/a11y_toolkit/a11yact.py +9 -1
  4. package/a11y_toolkit/a11yannotate.py +185 -0
  5. package/a11y_toolkit/a11yaudit.py +924 -196
  6. package/a11y_toolkit/a11ybadge.py +24 -17
  7. package/a11y_toolkit/a11ybudget.py +145 -1
  8. package/a11y_toolkit/a11ycorpus.py +58 -24
  9. package/a11y_toolkit/a11ycrit.py +114 -53
  10. package/a11y_toolkit/a11ydiff.py +104 -34
  11. package/a11y_toolkit/a11ydisprove.py +15 -8
  12. package/a11y_toolkit/a11ydocx.py +8 -6
  13. package/a11y_toolkit/a11ydom.py +567 -97
  14. package/a11y_toolkit/a11yen301549.py +53 -1
  15. package/a11y_toolkit/a11yengines.py +157 -0
  16. package/a11y_toolkit/a11yevidence.py +81 -33
  17. package/a11y_toolkit/a11yfix.py +131 -52
  18. package/a11y_toolkit/a11ygate.py +225 -0
  19. package/a11y_toolkit/a11yinit.py +73 -7
  20. package/a11y_toolkit/a11yjourney.py +110 -4
  21. package/a11y_toolkit/a11yledger.py +119 -12
  22. package/a11y_toolkit/a11ylocate.py +247 -0
  23. package/a11y_toolkit/a11yopenacr.py +10 -3
  24. package/a11y_toolkit/a11ypatches.py +154 -0
  25. package/a11y_toolkit/a11ypatterns.py +344 -0
  26. package/a11y_toolkit/a11ypdf.py +109 -53
  27. package/a11y_toolkit/a11yrgaa.py +60 -0
  28. package/a11y_toolkit/a11yroute.py +34 -12
  29. package/a11y_toolkit/a11ysarif.py +45 -18
  30. package/a11y_toolkit/a11yscope.py +67 -15
  31. package/a11y_toolkit/a11yscroll.py +7 -5
  32. package/a11y_toolkit/a11ystatement.py +30 -6
  33. package/a11y_toolkit/a11ytrace.py +293 -0
  34. package/a11y_toolkit/a11yvalidate.py +21 -15
  35. package/a11y_toolkit/a11yvpat.py +34 -7
  36. package/a11y_toolkit/a11yvtt.py +22 -6
  37. package/a11y_toolkit/a11ywiz.py +121 -0
  38. package/a11y_toolkit/contrast.py +62 -24
  39. package/a11y_toolkit/locales/en.json +185 -20
  40. package/a11y_toolkit/locales/es.json +186 -21
  41. package/a11y_toolkit/rgaa.json +2661 -0
  42. package/a11y_toolkit/server.py +157 -54
  43. package/package.json +2 -2
  44. package/a11y_toolkit/a11yplan.py +0 -214
  45. package/a11y_toolkit/a11ywcagem.py +0 -237
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env python3
2
+ """The guided wizard — the Canadian pattern, inverted, in the terminal.
3
+
4
+ 2-3 questions a person CAN answer (what are you building, which standard
5
+ applies to your market) configure everything the engine already knows
6
+ how to do: the audit runs with the right standard and the scope artifact
7
+ carries the machine proposals. (The 508 product tree and the tender-annex
8
+ generator live in the private a11y-toolkit-pro layer.)
9
+
10
+ Everything the wizard does is also available as individual commands
11
+ (audit --standard …, scope --solicitation …): the wizard composes, it
12
+ does not hide. Interactive by design; a piped stdin works too (tests,
13
+ CI) and an exhausted stdin aborts gracefully with the non-interactive
14
+ commands as the message.
15
+ """
16
+
17
+ import argparse
18
+ import json
19
+ import os
20
+ import sys
21
+
22
+ ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
23
+ sys.path.insert(0, ROOT)
24
+
25
+ from a11y_toolkit.a11yaudit import audit_html, audit_url # noqa: E402
26
+ from a11y_toolkit.a11yscope import build_scope # noqa: E402
27
+
28
+
29
+ def _t(key):
30
+ from .a11yi18n import pack
31
+ return pack(_LANG).get('wiz', {}).get(key) or key
32
+
33
+
34
+ def _ask(prompt, valid=None, default=None):
35
+ """input() con validación: reintenta hasta respuesta válida; en EOF
36
+ aborta con la salida no-interactiva como mensaje (el wizard compone
37
+ comandos que existen)."""
38
+ while True:
39
+ try:
40
+ ans = input(prompt).strip()
41
+ except EOFError:
42
+ print(_t('wiz_abort'))
43
+ sys.exit(1)
44
+ if not ans and default is not None:
45
+ return default
46
+ if valid is None:
47
+ return ans
48
+ if ans in valid:
49
+ return ans
50
+ print(' ' + '/'.join(valid) + '?')
51
+
52
+
53
+ _YESNO = ('y', 'Y', 's', 'S', 'si', 'sí', 'SI', 'yes', 'YES', 'Yes',
54
+ 'n', 'N', 'no', 'NO', 'No')
55
+ _YES = ('y', 'Y', 's', 'S', 'si', 'sí', 'SI', 'yes', 'YES', 'Yes')
56
+ _NO = ('n', 'N', 'no', 'NO', 'No')
57
+
58
+ _LANG = 'en'
59
+
60
+
61
+ def main(argv):
62
+ global _LANG
63
+ ap = argparse.ArgumentParser(
64
+ description='Guided wizard: 2-3 questions → standard, audit, scope '
65
+ 'and tender annex. Also non-interactive commands exist.')
66
+ ap.add_argument('--url', help='page to audit (skipped from the questions if given)')
67
+ ap.add_argument('--file', help='local html to audit')
68
+ ap.add_argument('--lang', default='en', choices=['en', 'es'])
69
+ ap.add_argument('-o', '--out', default='scope.json',
70
+ help='where the scope artifact is written (default scope.json)')
71
+ a = ap.parse_args(argv)
72
+ _LANG = a.lang
73
+
74
+ # Q0: qué auditar (flag o pregunta)
75
+ url = (a.url or '').strip()
76
+ if not url and not a.file:
77
+ url = _ask(_t('wiz_need_url') + ' URL: ', valid=None)
78
+
79
+ # Q1: qué estás construyendo
80
+ tgt = _ask(_t('wiz_q_target'), valid={'1', '2', '3', '4'})
81
+ if tgt == '4':
82
+ raw = _ask(_t('wiz_q_multi'))
83
+ targets = [x.strip() for x in raw.split(',') if x.strip() in ('web', 'documents', 'software')] \
84
+ or ['web']
85
+ target = targets[0]
86
+ else:
87
+ target = {'1': 'web', '2': 'documents', '3': 'software'}[tgt]
88
+ targets = [target]
89
+
90
+ # Q2: qué norma (508 GSA tree: capa privada a11y-toolkit-pro)
91
+ std_map = {'1': 'wcag22', '2': 'en301549', '3': 'rgaa'}
92
+ std = std_map[_ask(_t('wiz_q_std'), valid={'1', '2', '3'})]
93
+
94
+ answers = {}
95
+
96
+ # auditoría con el estándar elegido
97
+ std_arg = std if std in ('en301549', 'rgaa') else None
98
+ if url:
99
+ report = audit_url(url, timeout=30, lang=a.lang, standard=std_arg, target=targets[0])
100
+ else:
101
+ report = audit_html(open(a.file, encoding='utf-8', errors='replace').read()[:2_000_000],
102
+ url=a.file, lang=a.lang, standard=std_arg, target=targets[0])
103
+ if 'error' in report:
104
+ print(json.dumps(report, ensure_ascii=False))
105
+ return 1
106
+
107
+ scope = build_scope([report], standard=std, target=target,
108
+ answers=answers or None, lang=a.lang, targets=targets)
109
+ with open(a.out, 'w', encoding='utf-8') as f:
110
+ json.dump(scope, f, ensure_ascii=False, indent=1)
111
+
112
+ # (el anexo de pliego se retiró: a11y-toolkit-pro lo genera desde este
113
+ # MISMO artifact sellado — wizard_pro en la capa privada)
114
+ print(_t('wiz_done').format(scope=a.out, annex='—', score=report.get('score'),
115
+ ins=scope['counters']['in_scope'],
116
+ pro=scope['counters']['proposed_excluded']))
117
+ return 0
118
+
119
+
120
+ if __name__ == '__main__':
121
+ sys.exit(main(sys.argv[1:]))
@@ -77,6 +77,23 @@ def _hsl_a_rgb(h, s, l):
77
77
  return f(0), f(8), f(4)
78
78
 
79
79
 
80
+ def _hue_deg(x):
81
+ """Ángulo CSS con unidades — deg (por defecto), turn, rad, grad → grados.
82
+ None si no es numérico (antes: rstrip('deg') tragaba '0.5turn' y cascaba)."""
83
+ x = x.strip().lower()
84
+ for suf, factor in (('turn', 360.0), ('grad', 0.9),
85
+ ('rad', 180.0 / math.pi), ('deg', 1.0)):
86
+ if x.endswith(suf):
87
+ try:
88
+ return float(x[:-len(suf)]) * factor
89
+ except ValueError:
90
+ return None
91
+ try:
92
+ return float(x)
93
+ except ValueError:
94
+ return None
95
+
96
+
80
97
  def parse_color(s):
81
98
  """'#rgb' | '#rrggbb' | '#rrggbbaa' | rgb()/rgba() | hsl()/hsla() | nombre CSS
82
99
  → dict r,g,b (y 'a' si hay alfa). Acepta comas o espacios como separadores.
@@ -104,30 +121,40 @@ def parse_color(s):
104
121
  body, alfa_ext = re.split(r'\s*/\s*', body, 1)
105
122
  parts = [p for p in (x.strip() for x in re.split(r'[\s,]+', body)) if p]
106
123
  kind, v = m.group(1), parts
107
- if kind.startswith('rgb'):
124
+ try:
125
+ if kind.startswith('rgb'):
126
+ if len(v) < 3:
127
+ return None
128
+ def _channel(x):
129
+ if x.endswith('%'):
130
+ return max(0, min(255, round(float(x[:-1]) * 2.55)))
131
+ return max(0, min(255, int(float(x))))
132
+ c = {'r': _channel(v[0]), 'g': _channel(v[1]), 'b': _channel(v[2])}
133
+ if len(v) >= 4:
134
+ c['a'] = max(0.0, min(1.0, float(v[3].rstrip('%')) / (100 if v[3].endswith('%') else 1)))
135
+ elif alfa_ext:
136
+ c['a'] = max(0.0, min(1.0, float(alfa_ext.strip().rstrip('%')) / (100 if alfa_ext.strip().endswith('%') else 1)))
137
+ return c
108
138
  if len(v) < 3:
109
139
  return None
110
- def _channel(x):
111
- if x.endswith('%'):
112
- return max(0, min(255, round(float(x[:-1]) * 2.55)))
113
- return max(0, min(255, int(float(x))))
114
- c = {'r': _channel(v[0]), 'g': _channel(v[1]), 'b': _channel(v[2])}
140
+ h_ = _hue_deg(v[0])
141
+ if h_ is None:
142
+ return None
143
+ s_ = max(0.0, min(1.0, float(v[1].rstrip('%')) / 100.0))
144
+ l_ = max(0.0, min(1.0, float(v[2].rstrip('%')) / 100.0))
145
+ r, g, b = _hsl_a_rgb(h_, s_, l_)
146
+ c = {'r': max(0, min(255, r)), 'g': max(0, min(255, g)),
147
+ 'b': max(0, min(255, b))}
115
148
  if len(v) >= 4:
116
149
  c['a'] = max(0.0, min(1.0, float(v[3].rstrip('%')) / (100 if v[3].endswith('%') else 1)))
117
150
  elif alfa_ext:
118
- c['a'] = max(0.0, min(1.0, float(alfa_ext.strip().rstrip('%')) / (100 if alfa_ext.strip().endswith('%') else 1)))
151
+ # hsl(0 0% 0% / 0.5) — sintaxis moderna con barra: MISMO trato
152
+ # que rgb() con barra (el canal existía solo para la rama rgb)
153
+ c['a'] = max(0.0, min(1.0, float(alfa_ext.strip().rstrip('%'))
154
+ / (100 if alfa_ext.strip().endswith('%') else 1)))
119
155
  return c
120
- if len(v) < 3:
121
- return None
122
- h_ = float(v[0].rstrip('deg')) % 360
123
- s_ = max(0.0, min(1.0, float(v[1].rstrip('%')) / 100.0))
124
- l_ = max(0.0, min(1.0, float(v[2].rstrip('%')) / 100.0))
125
- r, g, b = _hsl_a_rgb(h_, s_, l_)
126
- c = {'r': max(0, min(255, r)), 'g': max(0, min(255, g)),
127
- 'b': max(0, min(255, b))}
128
- if len(v) >= 4:
129
- c['a'] = max(0.0, min(1.0, float(v[3].rstrip('%')) / (100 if v[3].endswith('%') else 1)))
130
- return c
156
+ except (ValueError, TypeError, OverflowError):
157
+ return None # contrato: color inválido → None, nunca traceback
131
158
  if t in COLOR_NAMES:
132
159
  h = COLOR_NAMES[t]
133
160
  return {'r': int(h[0:2], 16), 'g': int(h[2:4], 16), 'b': int(h[4:6], 16)}
@@ -213,10 +240,12 @@ def pair(fg_s, bg_s, with_suggestion=True, lang='en'):
213
240
  if fg.get('a', 1) < 1:
214
241
  fg = composite(fg, bg)
215
242
  alpha_note = hexs(fg)
216
- r = ratio(fg, bg)
243
+ # se redondea ANTES de los veredictos: lo mostrado y el veredicto nunca
244
+ # discrepan (un ratio en [4.495,4.5) no puede imprimir "4.5" y fallar)
245
+ r = round(ratio(fg, bg), 2)
217
246
  out = {
218
247
  'text': hexs(fg), 'background': hexs(bg),
219
- 'ratio': round(r, 2),
248
+ 'ratio': r,
220
249
  'verdicts': verdicts(r, lang),
221
250
  }
222
251
  if alpha_note:
@@ -300,20 +329,23 @@ def _percentile(vals, p):
300
329
  def decode_png(data):
301
330
  """Bytes PNG → (ancho, alto, bytes RGB). Sin dependencias.
302
331
 
303
- Soporta color types 0 (gris), 2 (RGB), 3 (paleta) y 6 (RGBA) a 8 bits;
304
- el alfa se compone sobre blanco (las capturas de navegador son opacas).
305
- Lanza ValueError si el PNG está fuera de ese soporte (p. ej. 16 bits)."""
332
+ Soporta color types 0 (gris), 2 (RGB), 3 (paleta) y 6 (RGBA) a 8 bits,
333
+ SIN entrelazado (Adam7); el alfa se compone sobre blanco (las capturas
334
+ de navegador son opacas). Lanza ValueError si el PNG está fuera de ese
335
+ soporte (p. ej. 16 bits, gris+alfa, entrelazado)."""
306
336
  import struct
307
337
  import zlib
308
338
  if data[:8] != b'\x89PNG\r\n\x1a\n':
309
339
  raise ValueError('not a PNG file')
310
340
  pos, idat, w, h, bd, ct, plte = 8, b'', 0, 0, 0, 0, None
341
+ interlace = 0
311
342
  while pos < len(data):
312
343
  ln = struct.unpack('>I', data[pos:pos + 4])[0]
313
344
  kind = data[pos + 4:pos + 8]
314
345
  body = data[pos + 8:pos + 8 + ln]
315
346
  if kind == b'IHDR':
316
347
  w, h, bd, ct = struct.unpack('>IIBB', body[:10])
348
+ interlace = body[12] if len(body) >= 13 else 0
317
349
  elif kind == b'IDAT':
318
350
  idat += body
319
351
  elif kind == b'PLTE':
@@ -323,9 +355,15 @@ def decode_png(data):
323
355
  pos += 12 + ln
324
356
  if bd != 8:
325
357
  raise ValueError(f'PNG bit depth {bd} unsupported (8-bit only)')
326
- channels = {0: 1, 2: 3, 3: 1, 4: 2, 6: 4}.get(ct)
358
+ if ct == 4:
359
+ raise ValueError('PNG color type 4 (grayscale+alpha) unsupported '
360
+ '(convert to RGBA (6) or RGB (2))')
361
+ channels = {0: 1, 2: 3, 3: 1, 6: 4}.get(ct)
327
362
  if channels is None:
328
363
  raise ValueError(f'PNG color type {ct} unsupported')
364
+ if interlace:
365
+ raise ValueError('PNG interlaced (Adam7) unsupported '
366
+ '(export non-interlaced)')
329
367
  if ct == 3 and not plte:
330
368
  raise ValueError('PNG palette without PLTE chunk')
331
369
  raw = zlib.decompress(idat)
@@ -8,7 +8,10 @@
8
8
  "audit": {
9
9
  "accesskey_dup": "{n} duplicated accesskey values: {example}.",
10
10
  "accesskey_dup_rem": "Duplicated accesskeys trigger the wrong control and clash with browser shortcuts; remove or make unique.",
11
- "aria_hidden_focusable": "{n} interactive elements (<{tag}>) with aria-hidden=\"true\": hidden from the screen reader yet still focusable.",
11
+ "aria_hidden_focusable": {
12
+ "one": "1 interactive element (<{tag}>) with aria-hidden=\"true\": hidden from the screen reader yet still focusable.",
13
+ "other": "{n} interactive elements (<{tag}>) with aria-hidden=\"true\": hidden from the screen reader yet still focusable."
14
+ },
12
15
  "aria_hidden_focusable_rem": "Remove aria-hidden from the focusable element, or add tabindex=\"-1\" if it must stay out of interaction.",
13
16
  "aria_ref_missing": "{n} aria-labelledby/describedby references point to ids that do not exist: {example}.",
14
17
  "aria_ref_missing_rem": "Fix or remove the reference: a broken aria-labelledby leaves the control with no accessible name.",
@@ -16,9 +19,14 @@
16
19
  "aria_value_invalid_rem": "Boolean aria-* only accept true/false/undefined, position ones integers, token ones their closed list (4.1.2). Fix or drop the attribute.",
17
20
  "audio_desc_missing": "{n} <video> without audio-description track (1.2.3/1.2.5): pending human judgment.",
18
21
  "audio_desc_missing_rem": "If the video carries essential visual information not narrated, publish audio description (track kind=\"descriptions\" or alternative) — a person watching the video decides.",
19
- "autocomplete": "{n} fields collecting user information without an autocomplete attribute: {example}.",
22
+ "autocomplete": {
23
+ "one": "1 field collecting user information without an autocomplete attribute: {example}.",
24
+ "other": "{n} fields collecting user information without an autocomplete attribute: {example}."
25
+ },
20
26
  "autocomplete_invalid": "{n} invalid autocomplete token values: {example}. Tokens must come from the HTML autofill standard (§7.5) or assistive tech cannot identify the purpose (1.3.5).",
21
27
  "autocomplete_invalid_rem": "Use standard tokens: email, tel, name, postal-code, one-time-code… (full list in the tool).",
28
+ "autocomplete_mismatch": "{n} fields with purpose contradicted between type and autocomplete: {example}. The browser cannot decide the purpose (1.3.5).",
29
+ "autocomplete_mismatch_rem": "For humans, don't make me think; for machines, don't make me guess: type and token must say the same thing. type=email takes an email-family token (email, username); type=tel, the tel family; type=url, url.",
22
30
  "autocomplete_rem": "Add autocomplete with the right token (email, tel, name, postal-code…, 1.3.5): free accessibility and autofill at zero cost.",
23
31
  "blank_no_warning": "{n} links with target=\"_blank\" that do not warn they open a new window.",
24
32
  "blank_no_warning_rem": "Add a text hint (or title/aria-label): \"(opens in a new window)\", or let the user decide.",
@@ -26,11 +34,17 @@
26
34
  "captcha_rem": "Offer alternatives: magic links, OAuth, human support. A CAPTCHA without an alternative excludes (3.3.8, new in WCAG 2.2 AA).",
27
35
  "char_shortcut": "{n} single-character keyboard shortcuts detected: {example}. Review (2.1.4).",
28
36
  "char_shortcut_rem": "Single-key shortcuts must be disablable, remappable, or active only on focus (2.1.4): voice-dictation users trigger every letter.",
29
- "click_nonfocusable": "{n} non-interactive elements (<{tag}>) with onclick, no role, no tabindex and no keyboard handling.",
37
+ "click_nonfocusable": {
38
+ "one": "1 non-interactive element (<{tag}>) with onclick, no role, no tabindex and no keyboard handling.",
39
+ "other": "{n} non-interactive elements (<{tag}>) with onclick, no role, no tabindex and no keyboard handling."
40
+ },
30
41
  "click_nonfocusable_rem": "Use a real <button>; if impossible, add role=\"button\", tabindex=\"0\" and Enter/Space handling (2.1.1).",
31
42
  "color_only_link": "Links distinguishable only by color detected in the rendered pass (1.4.1).",
32
43
  "color_only_link_rem": "A link inside text needs underline or another cue, or ≥3:1 contrast against surrounding text (1.4.1).",
33
- "ctrl_name": "{n} <{tag}> with no accessible name (no text, aria-label or title).",
44
+ "ctrl_name": {
45
+ "one": "1 <{tag}> with no accessible name (no text, aria-label or title).",
46
+ "other": "{n} <{tag}> with no accessible name (no text, aria-label or title)."
47
+ },
34
48
  "ctrl_name_rem": "The accessible name comes from inner text, aria-label, title, or an inner image with alt. An empty control is invisible to screen readers.",
35
49
  "dom_visual_order": "DOM order differs from visual order in {n} text blocks: review with keyboard (1.3.2).",
36
50
  "dom_visual_order_rem": "Programmatic reading order must match visual order: check flex order, grid placement and position absolute (1.3.2).",
@@ -38,18 +52,33 @@
38
52
  "down_event_rem": "Activate on the UP event (onclick/onmouseup): dragging away can abort — that is rule 2.5.2.",
39
53
  "drag_no_alt": "{n} drag handlers with no visible click/button alternative: {example}. Review (2.5.7).",
40
54
  "drag_no_alt_rem": "Every drag action needs a non-dragging alternative: up/down buttons, context menu, arrows (2.5.7).",
41
- "dup_ids": "{n} duplicated ids; they can break label-for and aria-labelledby associations.",
55
+ "dup_ids": {
56
+ "one": "1 duplicated id; it can break label-for and aria-labelledby associations.",
57
+ "other": "{n} duplicated ids; they can break label-for and aria-labelledby associations."
58
+ },
42
59
  "dup_ids_rem": "Make ids unique: <label for> and aria-labelledby only point at the first match.",
43
60
  "element_lang_invalid": "{n} invalid lang attributes on elements (BCP-47): {example}.",
44
61
  "element_lang_invalid_rem": "Foreign-language fragments carry lang with a valid code (3.1.2): <blockquote lang=\"en\">…</blockquote>.",
45
- "empty_heading": "{n} empty headings (<h*> with no text).",
62
+ "empty_heading": {
63
+ "one": "1 empty heading (<h*> with no text).",
64
+ "other": "{n} empty headings (<h*> with no text)."
65
+ },
46
66
  "empty_heading_rem": "Remove empty headings or give them text: they show up as gaps in the reader's index.",
47
67
  "fetch_error": "could not download: {e}",
48
- "field_label": "{n} form fields with no associated <label> and no accessible name.",
68
+ "field_label": {
69
+ "one": "1 form field with no associated <label> and no accessible name.",
70
+ "other": "{n} form fields with no associated <label> and no accessible name."
71
+ },
49
72
  "field_label_rem": "Associate <label for=\"id\"> (or wrap the field), or use aria-label. Applies to input, select and textarea.",
50
- "fieldset_missing": "{n} radio/checkbox groups without <fieldset><legend>: screen readers do not announce the common question (1.3.1).",
73
+ "fieldset_missing": {
74
+ "one": "1 radio/checkbox group without <fieldset><legend>: screen readers do not announce the group.",
75
+ "other": "{n} radio/checkbox groups without <fieldset><legend>: screen readers do not announce the common question (1.3.1)."
76
+ },
51
77
  "fieldset_missing_rem": "Wrap groups in <fieldset><legend>Common question</legend>…</fieldset> (1.3.1): without it, each radio is announced without context.",
52
- "financial_no_confirm": "{n} financial/legal form(s) without a detectable confirmation step (3.3.4).",
78
+ "financial_no_confirm": {
79
+ "one": "1 financial/legal form without a detectable confirmation step (3.3.4).",
80
+ "other": "{n} financial/legal form(s) without a detectable confirmation step (3.3.4)."
81
+ },
53
82
  "financial_no_confirm_rem": "Submissions with legal/financial consequences must be reversible, checked, or confirmed (3.3.4): terms checkbox, \"Review and confirm\" button, or review step.",
54
83
  "forced_colors_svg": "{n} SVGs with hardcoded colored fill: under forced-colors (Windows High Contrast) the fill falls back to inherited and the icon can turn invisible.",
55
84
  "forced_colors_svg_rem": "Use fill=\"currentColor\" (inherits text color, which the system already adjusts) or the system keywords (CanvasText).",
@@ -65,12 +94,28 @@
65
94
  "help_inconsistent_rem": "When help appears on multiple pages, it must appear in the same relative order and consistently (3.2.6, new in 2.2): same menu, same place.",
66
95
  "iframe_title": "{n} <iframe> without an accessible title.",
67
96
  "iframe_title_rem": "Add a descriptive title to the iframe (screen readers announce it on arrival).",
68
- "images_of_text": "{n} images that appear to be rendered text (very long alt{ej2}). Review (1.4.5).",
97
+ "images_of_text": {
98
+ "one": "1 suspicious image of text (1.4.5): {ej2}",
99
+ "other": "{n} images that appear to be rendered text (very long alt{ej2}). Review (1.4.5)."
100
+ },
69
101
  "images_of_text_rem": "Except for logotypes, present text as real text (1.4.5): it rescales, reflows and translates; an image does not.",
70
102
  "overlay_widgets_note": "A third-party accessibility overlay widget was detected (see overlay_widgets). Overlays do not make a site accessible — see the community Overlay Fact Sheet (overlayfactsheet.com). Reported as information for procurement diligence, not as a WCAG finding.",
71
- "img_no_alt": "{n} <img> without an alt attribute (not even alt=\"\").",
103
+ "img_no_alt": {
104
+ "one": "1 <img> without an alt attribute (not even alt=\"\").",
105
+ "other": "{n} <img> without an alt attribute (not even alt=\"\")."
106
+ },
72
107
  "img_no_alt_rem": "Add alt to every <img>: descriptive text when it conveys information, alt=\"\" when decorative. Same requirement for <input type=\"image\"> and <area>.",
73
- "input_img_alt": "<input type=\"image\"> without alt (image button with no name).",
108
+ "canvas_no_accessible_layer": {
109
+ "one": "1 <canvas> with no static accessible layer (no aria-label/labelledby/title/role and no fallback text).",
110
+ "other": "{n} <canvas> with no static accessible layer (no aria-label/labelledby/title/role and no fallback text inside)."
111
+ },
112
+ "canvas_no_accessible_layer_rem": "Give each canvas an accessible layer: aria-label or role=\"img\" with a name, plus fallback text inside the tag; for charts, the data as a table or summary is the strong fix. Static filter: if a chart library injects the layer at runtime, the rendered pass is the judge.",
113
+ "chart_no_data_equivalent": "{n} named chart/graphic exposes no machine-visible data equivalent (no resolvable aria-details/aria-describedby, no table nearby).",
114
+ "chart_no_data_equivalent_rem": "A chart that carries data needs it in text: link the data table or long description with aria-details or aria-describedby, or place a real table next to the graphic. REVIEW finding: if the data lives in surrounding prose this can pass — judge the zone.",
115
+ "input_img_alt": {
116
+ "one": "1 <input type=\"image\"> without an alt attribute.",
117
+ "other": "<input type=\"image\"> without alt (image button with no name)."
118
+ },
74
119
  "input_img_alt_rem": "Add descriptive alt to the input type=\"image\" (it is its accessible name), or replace it with a <button> with text or <input type=\"submit\" value=\"…\">.",
75
120
  "label_in_name": "{n} controls whose aria-label does not contain the visible text («{example}»): voice-input users say what they see (2.5.3).",
76
121
  "label_in_name_rem": "The accessible name must CONTAIN the visible label: \"Summer offers (opens in new window)\", not \"More info\". Use visible text + suffix.",
@@ -95,9 +140,15 @@
95
140
  "motion_actuation_rem": "What motion activates must also be activatable via UI (button) and disablable (2.5.4).",
96
141
  "motion_moving": "{n} moving/looping contents with no visible pause control: {example}. Review (2.2.2).",
97
142
  "motion_moving_rem": "Content moving/blinking >5s needs a pause/stop mechanism (2.2.2): <marquee> has none; looping animations do not either by default.",
98
- "multi_h1": "{n} <h1> on the page (recommended maximum: 1).",
143
+ "multi_h1": {
144
+ "one": "1 <h1> on the page is fine; more than one is not recommended.",
145
+ "other": "{n} <h1> on the page (recommended maximum: 1)."
146
+ },
99
147
  "multi_h1_rem": "Keep a single h1 (page title) and demote the rest one level.",
100
- "multi_label": "{n} fields with more than one associated <label for>.",
148
+ "multi_label": {
149
+ "one": "1 field with multiple associated labels; assistive tech may read them concatenated or fight.",
150
+ "other": "{n} fields with more than one associated <label for>."
151
+ },
101
152
  "multi_label_rem": "One field, one label: screen readers announce concatenated labels. Merge the text into one.",
102
153
  "nav_inconsistent": "Repeated navigation changes across site pages ({example}) (3.2.3).",
103
154
  "nav_inconsistent_rem": "Repeated navigation mechanisms must appear in the same relative order on every page (3.2.3): shared template.",
@@ -113,7 +164,10 @@
113
164
  "no_status_regions_rem": "Add role=\"status\" or aria-live=\"polite\" for toasts, save confirmations, search results (4.1.3).",
114
165
  "orientation_lock": "Orientation lock detected: {example}. Review (1.3.4).",
115
166
  "orientation_lock_rem": "Content must not be locked to one orientation unless the exception demonstrably applies (1.3.4): remove screen.orientation.lock() and orientation-forcing media queries.",
116
- "placeholder_only": "{n} fields using placeholder as their only label (no <label>): {example}. The placeholder vanishes on input (3.3.2).",
167
+ "placeholder_only": {
168
+ "one": "1 field using placeholder as its only label (no <label>): {example}. The placeholder disappears on input.",
169
+ "other": "{n} fields using placeholder as their only label (no <label>): {example}. The placeholder vanishes on input (3.3.2)."
170
+ },
117
171
  "placeholder_only_rem": "Placeholder is NOT a label: add a visible <label for=\"id\">. The placeholder disappears when typing starts and screen readers do not always announce it (3.3.2).",
118
172
  "reduced_motion_ignored": "{n} looping animations still run with prefers-reduced-motion set (before {n}, after {nr}): the user's preference is ignored (2.2.2).",
119
173
  "reduced_motion_ignored_rem": "Wrap animations in @media (prefers-reduced-motion: reduce) { animation: none } — or pause via the Animation API. The user asked for less motion; honor it.",
@@ -124,7 +178,7 @@
124
178
  "role_unknown": "{n} unknown ARIA roles: {example}. Screen readers ignore them.",
125
179
  "role_unknown_rem": "Use roles from the ARIA specification (button, dialog, navigation…) or drop the attribute and rely on semantic HTML.",
126
180
  "same_name_links": {
127
- "one": "1 pair of links with identical text pointing to different destinations.",
181
+ "one": "1 link name resolves to different destinations — check that context disambiguates it.",
128
182
  "other": "{n} pairs of links with identical text pointing to different destinations."
129
183
  },
130
184
  "same_name_links_rem": "Differentiate the names (or unify the destination): \"Reports\" ×3 with three different URLs is a problem for anyone navigating by link list.",
@@ -133,7 +187,10 @@
133
187
  "sensory_text_rem": "Do not instruct by position/shape/color alone (\"the button on the right\"): name things (1.3.3).",
134
188
  "tabindex_pos": "{n} elements with a positive tabindex (overrides natural order).",
135
189
  "tabindex_pos_rem": "Use tabindex=\"0\" or drop the attribute: tab order must follow the DOM.",
136
- "table_no_th": "{n} <table> with no <th> cells.",
190
+ "table_no_th": {
191
+ "one": "1 <table> with no <th> cells.",
192
+ "other": "{n} <table> with no <th> cells."
193
+ },
137
194
  "table_no_th_rem": "Mark row/column headers with <th> (plus scope) so the reader can associate cells.",
138
195
  "text_spacing_clip": "{n} texts clipped when the 1.4.12 spacing overrides apply (line-height 1.5, letter 0.12em): review.",
139
196
  "text_spacing_clip_rem": "Content must survive text-spacing overrides without clipping: replace fixed heights with min-height (1.4.12).",
@@ -141,15 +198,34 @@
141
198
  "title_generic_rem": "One unique title per page: content + site (“Contact — MaisMedia”), never “Untitled”, “Home” or “Document”.",
142
199
  "title_missing": "The page has no <title> with content.",
143
200
  "title_missing_rem": "Write a unique, descriptive <title> per page (screen reader's first announcement, tab text).",
144
- "video_autoplay": "{n} media elements with autoplay (audio >3s with no way to stop it).",
201
+ "video_autoplay": {
202
+ "one": "1 media element with autoplay (audio >3s with no way to stop it).",
203
+ "other": "{n} media elements with autoplay (audio >3s with no way to stop it)."
204
+ },
145
205
  "video_autoplay_rem": "Remove autoplay or add muted + a visible pause/stop control (1.4.2): audio that starts on its own disrupts screen-reader users.",
146
- "video_captions": "{n} <video> without <track kind=\"captions\">.",
206
+ "video_captions": {
207
+ "one": "1 <video> without <track kind=\"captions\">.",
208
+ "other": "{n} <video> without <track kind=\"captions\">."
209
+ },
147
210
  "video_captions_rem": "Publish captions for the video audio track (1.2.2). If decorative and silent, mark it as such.",
148
211
  "zoom_max": "The viewport limits zoom (maximum-scale={v}; recommend no limit or ≥2).",
149
212
  "zoom_max_rem": "Remove maximum-scale from the viewport, or set it to 2 or higher, so text can be enlarged (1.4.4).",
150
213
  "zoom_no": "The viewport blocks user zoom (user-scalable=no/0).",
151
214
  "zoom_no_rem": "Remove user-scalable=no and maximum-scale: zooming is the user's right (1.4.4).",
152
- "rendered_reason": "requires the rendered audit (a11y_audit_dom / a11ytoolkit dom): computed styles, cascade, var(), real layout"
215
+ "rendered_reason": "requires the rendered audit (a11y_audit_dom / a11ytoolkit dom): computed styles, cascade, var(), real layout",
216
+ "err_unparseable": "unparseable HTML: {e}",
217
+ "err_too_big": "HTML larger than {mb} MB",
218
+ "err_not_html": "the URL does not return HTML (Content-Type: {ct})",
219
+ "role_no_tabindex": {
220
+ "one": "1 element with an interactive role (button/link) and no tabindex: not reachable by keyboard (JS could add it at runtime — the rendered pass confirms).",
221
+ "other": "{n} elements with an interactive role (button/link) and no tabindex: not reachable by keyboard (JS could add it at runtime — the rendered pass confirms)."
222
+ },
223
+ "role_no_tabindex_rem": "Add tabindex=\"0\" to every element that receives role=\"button\"/\"link\", plus Enter/Space key handling — or use the native <button>/<a href> element.",
224
+ "err_redirect_blocked": "redirect to a disallowed destination (private network): {url}",
225
+ "alt_quality": "{n} images with low-quality alt text (filenames, generic words or placeholders).",
226
+ "alt_quality_rem": "Alt like \"image\", \"foto\", \"img_123.jpg\" or a dash says nothing to a screen-reader user. Replace it with what the image conveys in its context; if the image is decorative, use alt=\"\" so assistive tech skips it.",
227
+ "onfocus_blur": "{n} element(s) whose onfocus handler removes focus (onfocus=\"blur()\"): keyboard users cannot reach them at all.",
228
+ "onfocus_blur_rem": "Remove the onfocus=\"blur()\" handler: stealing focus makes the element unreachable by keyboard (2.1.1). If the element must not be focusable, use tabindex=\"-1\" instead of taking focus away."
153
229
  },
154
230
  "badge": {
155
231
  "name": "a11y-toolkit",
@@ -237,6 +313,10 @@
237
313
  "input_navigates_rem": "Changing a setting must never navigate without user request (3.2.2): add an \"Apply\" button or confirm before submitting.",
238
314
  "kbd_trap": "KEYBOARD TRAP: {n} controls caught in a cycle ({cycle}) and Escape does not release. Focus cannot leave (2.1.2).",
239
315
  "kbd_trap_rem": "Every focus-containing component (modal, menu) must release with Escape (ideally click-outside too): close it and return focus to the trigger. Test it with the keyboard alone.",
316
+ "skip_target_hidden": "Skip link \"{label}\" leads to hidden content: after activating it, the target ({id}) is still not exposed (display:none, hidden, closed details or aria-hidden). The bypass mechanism lands on nothing perceivable (2.4.1).",
317
+ "skip_target_hidden_rem": "A bypass mechanism must land on perceivable content (2.4.1): point the link at visible content, or have the page reveal or expand the target on activation (hashchange or click), and give the target tabindex=\"-1\" so focus follows.",
318
+ "placeholder_contrast": "{n} placeholders with insufficient contrast: {det}. The placeholder is text low-vision users must read, and 1.4.3 does not distinguish pseudo-elements (4.5:1, or 3:1 large text).",
319
+ "placeholder_contrast_rem": "Give the placeholder its own color at ≥4.5:1 against the field background (the browser default gray sits at the minimum and fails on non-white backgrounds). Safe recipe: same color as the field text with opacity 0.7.",
240
320
  "limits": "Rendered audit: honest heuristics, no substitute for a screen reader or manual review. Contrast computed over computed backgrounds; cases with background images are reported as \"review\". 2.5.8 allows exceptions (equivalent inline, spacing) approximated here.",
241
321
  "reduced_motion_ignored": "{n} looping animations still run with prefers-reduced-motion set (before {n}, after {nr}): the user's preference is ignored (2.2.2).",
242
322
  "reduced_motion_ignored_rem": "Wrap animations in @media (prefers-reduced-motion: reduce) { animation: none } — or pause via the Animation API. The user asked for less motion; honor it.",
@@ -272,6 +352,12 @@
272
352
  "A dialog traps the keyboard and Escape does not close it.",
273
353
  "Close the dialog on Escape and return focus to the trigger."
274
354
  ],
355
+ "journey_drag_only": [
356
+ "2.5.7",
357
+ "high",
358
+ "The only way to complete the step is a drag gesture — no single-pointer alternative exists.",
359
+ "Provide a non-drag alternative (button, slider with arrow keys) that performs the same action."
360
+ ],
275
361
  "journey_duplicate_targets": [
276
362
  "4.1.2",
277
363
  "medium",
@@ -284,6 +370,12 @@
284
370
  "The tree changed after the action (content replaced) with no announcement — the agent’s map went stale.",
285
371
  "Announce dynamic region updates (role=status/aria-live) and keep focus stable."
286
372
  ],
373
+ "journey_error_no_suggestion": [
374
+ "3.3.3",
375
+ "medium",
376
+ "An error stopped the step but offers no fix the user can act on.",
377
+ "Add corrective text: what went wrong and the exact way to fix it."
378
+ ],
287
379
  "journey_error_silent": [
288
380
  "3.3.1",
289
381
  "high",
@@ -296,6 +388,12 @@
296
388
  "After an action, focus disappeared or jumped somewhere unexpected.",
297
389
  "Move focus programmatically to the logical destination after inserting or replacing content."
298
390
  ],
391
+ "journey_focus_not_visible": [
392
+ "2.4.7",
393
+ "high",
394
+ "The keyboard focus indicator is invisible or too faint to follow at a journey step.",
395
+ "Give the focused element a visible indicator (outline/ring) with 3:1 contrast against adjacent colors."
396
+ ],
299
397
  "journey_generic_link": [
300
398
  "2.4.4",
301
399
  "low",
@@ -314,6 +412,12 @@
314
412
  "Information essential to the task is missing from the accessibility tree.",
315
413
  "Express the relationship with real semantics (list, heading, table), not layout."
316
414
  ],
415
+ "journey_hover_only": [
416
+ "1.4.13",
417
+ "medium",
418
+ "Information needed to proceed appears only on hover and cannot be dismissed or reached by keyboard.",
419
+ "Make the content dismissible (Escape), hoverable and persistent — or expose it without hover."
420
+ ],
317
421
  "journey_landmark_missing": [
318
422
  "2.4.1",
319
423
  "medium",
@@ -338,6 +442,12 @@
338
442
  "A control needed for the task is not reachable or operable by keyboard.",
339
443
  "Make it focusable and keyboard-operable; pointer-only is never enough."
340
444
  ],
445
+ "journey_reflow_breaks": [
446
+ "1.4.10",
447
+ "medium",
448
+ "At 320px the step loses content or requires two-dimensional scrolling.",
449
+ "Use responsive layout so content reflows without horizontal scroll at 320px."
450
+ ],
341
451
  "journey_status_silent": [
342
452
  "4.1.3",
343
453
  "medium",
@@ -355,8 +465,38 @@
355
465
  "high",
356
466
  "A control needed for the task is announced without a name (\"button\", bare).",
357
467
  "Give the control an accessible name: visible text, aria-label or aria-labelledby."
468
+ ],
469
+ "journey_zoom_blocked": [
470
+ "1.4.4",
471
+ "high",
472
+ "The page blocks browser zoom, so the step cannot be magnified.",
473
+ "Remove zoom-blocking viewport directives; text must resize to 200% without loss of content."
358
474
  ]
359
475
  },
476
+ "patterns": {
477
+ "pattern_dialog_esc_no_close": "An open dialog does not close with Escape.",
478
+ "pattern_dialog_esc_no_close_rem": "Close the dialog on Escape (keydown handler or native <dialog>), then return focus to the trigger.",
479
+ "pattern_modal_focus_escapes": "Focus escaped a modal dialog (aria-modal=true) while tabbing.",
480
+ "pattern_modal_focus_escapes_rem": "Trap focus inside the modal (cycle the tab order or make background content inert) and return focus to the trigger on close.",
481
+ "pattern_tabs_arrows_dead": "A tablist with {n} tabs ignores ArrowRight: focus does not move between tabs (roving tabindex missing).",
482
+ "pattern_tabs_arrows_dead_rem": "Move focus across tabs with Left/Right arrows (roving tabindex); selection by focus or by Enter/Space (manual).",
483
+ "pattern_tabs_no_activation": "A tab received focus via arrows but never becomes selected (aria-selected never turns true).",
484
+ "pattern_tabs_no_activation_rem": "Make selection follow focus (automatic activation) or activate on Enter/Space (manual) — aria-selected must reflect the visible panel.",
485
+ "pattern_disclosure_state_frozen": "Activating “{name}” never flips aria-expanded: the exposed state contradicts the visual.",
486
+ "pattern_disclosure_state_frozen_rem": "Toggle aria-expanded (true/false) on every activation and point aria-controls at the region it reveals.",
487
+ "pattern_combobox_no_open": "A combobox never opens its popup with ArrowDown (no aria-expanded, no visible listbox).",
488
+ "pattern_combobox_no_open_rem": "Open the listbox on ArrowDown / Alt+ArrowDown and flip aria-expanded=true; keep focus on the input while filtering.",
489
+ "pattern_combobox_esc_no_close": "A combobox popup stays open after Escape.",
490
+ "pattern_combobox_esc_no_close_rem": "Close the popup on Escape, restore aria-expanded=false and return focus to the input.",
491
+ "pattern_menu_no_open": "A menu button never opens its menu on activation (no visible menu, no aria-expanded).",
492
+ "pattern_menu_no_open_rem": "Open the menu on click/Enter/Space, set aria-expanded=true and move focus to its first item.",
493
+ "pattern_menu_esc_no_close": "A menu stays open after Escape.",
494
+ "pattern_menu_esc_no_close_rem": "Close the menu on Escape, restore aria-expanded=false and return focus to the button.",
495
+ "pattern_slider_arrows_dead": "A slider ignores the arrow keys: aria-valuenow never changes.",
496
+ "pattern_slider_arrows_dead_rem": "Change the value with ArrowRight/Up and ArrowLeft/Down (Home/End for the limits) and keep aria-valuenow in sync.",
497
+ "pattern_slider_no_state": "A slider is missing its value trio (aria-valuenow / valuemin / valuemax).",
498
+ "pattern_slider_no_state_rem": "Expose aria-valuenow, aria-valuemin and aria-valuemax (plus aria-valuetext when the unit is not obvious)."
499
+ },
360
500
  "pdf": {
361
501
  "limits": "Zero-dep structural screening: full PDF/UA conformance needs a spec validator (veraPDF). This screening finds what makes full validation pointless.",
362
502
  "pdf_button_no_name": "{n} buttons without accessible name (/TU): a screen-reader user reaches them as just \"button\".",
@@ -562,5 +702,30 @@
562
702
  "note": "Applies to relay services and emergency-communication ICT."
563
703
  }
564
704
  }
705
+ },
706
+ "wiz": {
707
+ "wiz_q_target": "What are you building?\n 1 = web site/app\n 2 = documents (PDF/Office)\n 3 = non-web software\n 4 = several of those\nAnswer (1-4): ",
708
+ "wiz_q_multi": "Which ones? comma-separated (web,documents,software): ",
709
+ "wiz_q_std": "Which standard applies to your market or contract?\n 1 = WCAG 2.2 (global)\n 2 = EN 301 549 (EU / EAA / Ley 11/2023)\n 3 = RGAA 4.1 (France)",
710
+ "wiz_done": "Done. Scope: {scope}\nScore: {score} · in scope: {ins} · proposed out: {pro}\n(the tender annex and the 508 tree live in the private pro layer)",
711
+ "wiz_abort": "No input received — aborted. Everything the wizard does is also available as: a11ytoolkit scope --standard … / audit --standard … (a11ytoolkit scope --help)",
712
+ "wiz_need_url": "A URL (or HTML via --file) is needed to run the audit."
713
+ },
714
+ "locate": {
715
+ "loc_no_query": "Empty query: nothing to locate.",
716
+ "loc_no_match": "No named element matches \"{q}\". Only elements with an accessible name are indexed (controls, headings, images with alt, iframes with title, fields with an explicit name) — a match is never invented.",
717
+ "loc_ambiguous": "{n} elements share the name \"{q}\" — refusing to pick one. Inspect matches[] or pass multiple=true.",
718
+ "loc_multiple": "Several exact matches — all listed in matches[] (multiple=true).",
719
+ "loc_partial": "No exact accessible name \"{q}\"; the best partial match is returned — review it before acting.",
720
+ "loc_partial_ambiguous": "{n} partial matches, none exact for \"{q}\" — inspect matches[]."
721
+ },
722
+ "patches": {
723
+ "pat_bad_format": "Not an a11y-patches/1 artifact: verify refuses to judge it.",
724
+ "pat_stale": "This page is not the one the patch-set was built from (SHA-256 mismatch): the set invalidates itself and nothing is applied.",
725
+ "pat_mismatch": "The same page no longer produces the same fixes (engine drift or a tampered set): nothing is applied; compare reproduced[] and recorded[].",
726
+ "pat_reproduced": "Every recorded fix reproduced exactly on this page: the fixed html is returned for review."
727
+ },
728
+ "journeyrec": {
729
+ "bad_format": "Not an a11y-journey/1 record: verification refuses to judge it."
565
730
  }
566
731
  }