@kinti/a11y-toolkit 5.22.1 → 5.22.3

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 (38) hide show
  1. package/LICENSE +21 -0
  2. package/a11y_toolkit/__init__.py +5 -0
  3. package/a11y_toolkit/a11y.py +117 -0
  4. package/a11y_toolkit/a11yact.py +167 -0
  5. package/a11y_toolkit/a11yaudit.py +1951 -0
  6. package/a11y_toolkit/a11ybadge.py +102 -0
  7. package/a11y_toolkit/a11ybudget.py +122 -0
  8. package/a11y_toolkit/a11ycrit.py +1017 -0
  9. package/a11y_toolkit/a11ydiff.py +192 -0
  10. package/a11y_toolkit/a11ydisprove.py +175 -0
  11. package/a11y_toolkit/a11ydocx.py +132 -0
  12. package/a11y_toolkit/a11ydom.py +1831 -0
  13. package/a11y_toolkit/a11yevidence.py +272 -0
  14. package/a11y_toolkit/a11yfix.py +330 -0
  15. package/a11y_toolkit/a11yi18n.py +100 -0
  16. package/a11y_toolkit/a11yinit.py +113 -0
  17. package/a11y_toolkit/a11yjourney.py +284 -0
  18. package/a11y_toolkit/a11yledger.py +210 -0
  19. package/a11y_toolkit/a11ymutants.py +406 -0
  20. package/a11y_toolkit/a11yopenacr.py +207 -0
  21. package/a11y_toolkit/a11ypdf.py +273 -0
  22. package/a11y_toolkit/a11yroute.py +378 -0
  23. package/a11y_toolkit/a11ysarif.py +139 -0
  24. package/a11y_toolkit/a11yscroll.py +212 -0
  25. package/a11y_toolkit/a11ystatement.py +158 -0
  26. package/a11y_toolkit/a11yvalidate.py +127 -0
  27. package/a11y_toolkit/a11yvpat.py +238 -0
  28. package/a11y_toolkit/a11yvtt.py +136 -0
  29. package/a11y_toolkit/a11ywcag3.py +262 -0
  30. package/a11y_toolkit/a11ywcagem.py +177 -0
  31. package/a11y_toolkit/arialive.js +107 -0
  32. package/a11y_toolkit/arialive_js.py +113 -0
  33. package/a11y_toolkit/contrast.py +536 -0
  34. package/a11y_toolkit/locales/_template.json +468 -0
  35. package/a11y_toolkit/locales/en.json +525 -0
  36. package/a11y_toolkit/locales/es.json +525 -0
  37. package/a11y_toolkit/server.py +1529 -0
  38. package/package.json +7 -2
@@ -0,0 +1,1017 @@
1
+ #!/usr/bin/env python3
2
+ """WCAG 2.2 criterion knowledge (es/en) — the "what it is" behind the auditor.
3
+
4
+ a11y_criterion(code) returns, for every criterion the toolkit evaluates: the
5
+ official name, level, what it requires, typical failures, how to verify it
6
+ manually and with which toolkit tool. It is the bridge between an automated
7
+ finding and actually understanding the criterion.
8
+
9
+ CLI:
10
+ a11ycrit.py 2.5.8 [--lang es]
11
+ a11ycrit.py --signal kbd_trap [--lang en]
12
+ a11ycrit.py --list
13
+ """
14
+
15
+ import argparse
16
+ import json
17
+ import sys
18
+
19
+
20
+ # Enlace oficial Understanding WCAG 2.2 por criterio (w3.org, índice 2026-10).
21
+ # Fuente: https://www.w3.org/WAI/WCAG22/Understanding/ — los 86 criterios.
22
+ _UNDERSTANDING = {
23
+ '1.1.1': 'non-text-content',
24
+ '1.2.1': 'audio-only-and-video-only-prerecorded',
25
+ '1.2.2': 'captions-prerecorded',
26
+ '1.2.3': 'audio-description-or-media-alternative-prerecorded',
27
+ '1.2.4': 'captions-live',
28
+ '1.2.5': 'audio-description-prerecorded',
29
+ '1.2.6': 'sign-language-prerecorded',
30
+ '1.2.7': 'extended-audio-description-prerecorded',
31
+ '1.2.8': 'media-alternative-prerecorded',
32
+ '1.2.9': 'audio-only-live',
33
+ '1.3.1': 'info-and-relationships',
34
+ '1.3.2': 'meaningful-sequence',
35
+ '1.3.3': 'sensory-characteristics',
36
+ '1.3.4': 'orientation',
37
+ '1.3.5': 'identify-input-purpose',
38
+ '1.3.6': 'identify-purpose',
39
+ '1.4.1': 'use-of-color',
40
+ '1.4.2': 'audio-control',
41
+ '1.4.3': 'contrast-minimum',
42
+ '1.4.4': 'resize-text',
43
+ '1.4.5': 'images-of-text',
44
+ '1.4.6': 'contrast-enhanced',
45
+ '1.4.7': 'low-or-no-background-audio',
46
+ '1.4.8': 'visual-presentation',
47
+ '1.4.9': 'images-of-text-no-exception',
48
+ '1.4.10': 'reflow',
49
+ '1.4.11': 'non-text-contrast',
50
+ '1.4.12': 'text-spacing',
51
+ '1.4.13': 'content-on-hover-or-focus',
52
+ '2.1.1': 'keyboard',
53
+ '2.1.2': 'no-keyboard-trap',
54
+ '2.1.3': 'keyboard-no-exception',
55
+ '2.1.4': 'character-key-shortcuts',
56
+ '2.2.1': 'timing-adjustable',
57
+ '2.2.2': 'pause-stop-hide',
58
+ '2.2.3': 'no-timing',
59
+ '2.2.4': 'interruptions',
60
+ '2.2.5': 're-authenticating',
61
+ '2.2.6': 'timeouts',
62
+ '2.3.1': 'three-flashes-or-below-threshold',
63
+ '2.3.2': 'three-flashes',
64
+ '2.3.3': 'animation-from-interactions',
65
+ '2.4.1': 'bypass-blocks',
66
+ '2.4.2': 'page-titled',
67
+ '2.4.3': 'focus-order',
68
+ '2.4.4': 'link-purpose-in-context',
69
+ '2.4.5': 'multiple-ways',
70
+ '2.4.6': 'headings-and-labels',
71
+ '2.4.7': 'focus-visible',
72
+ '2.4.8': 'location',
73
+ '2.4.9': 'link-purpose-link-only',
74
+ '2.4.10': 'section-headings',
75
+ '2.4.11': 'focus-not-obscured-minimum',
76
+ '2.4.12': 'focus-not-obscured-enhanced',
77
+ '2.4.13': 'focus-appearance',
78
+ '2.5.1': 'pointer-gestures',
79
+ '2.5.2': 'pointer-cancellation',
80
+ '2.5.3': 'label-in-name',
81
+ '2.5.4': 'motion-actuation',
82
+ '2.5.5': 'target-size-enhanced',
83
+ '2.5.6': 'concurrent-input-mechanisms',
84
+ '2.5.7': 'dragging-movements',
85
+ '2.5.8': 'target-size-minimum',
86
+ '3.1.1': 'language-of-page',
87
+ '3.1.2': 'language-of-parts',
88
+ '3.1.3': 'unusual-words',
89
+ '3.1.4': 'abbreviations',
90
+ '3.1.5': 'reading-level',
91
+ '3.1.6': 'pronunciation',
92
+ '3.2.1': 'on-focus',
93
+ '3.2.2': 'on-input',
94
+ '3.2.3': 'consistent-navigation',
95
+ '3.2.4': 'consistent-identification',
96
+ '3.2.5': 'change-on-request',
97
+ '3.2.6': 'consistent-help',
98
+ '3.3.1': 'error-identification',
99
+ '3.3.2': 'labels-or-instructions',
100
+ '3.3.3': 'error-suggestion',
101
+ '3.3.4': 'error-prevention-legal-financial-data',
102
+ '3.3.5': 'help',
103
+ '3.3.6': 'error-prevention-all',
104
+ '3.3.7': 'redundant-entry',
105
+ '3.3.8': 'accessible-authentication-minimum',
106
+ '3.3.9': 'accessible-authentication-enhanced',
107
+ '4.1.1': 'parsing',
108
+ '4.1.2': 'name-role-value',
109
+ '4.1.3': 'status-messages'
110
+ }
111
+
112
+ # code → (nivel, {es: (nombre, exige, fallos, prueba)}, {en: ...})
113
+ _C = {
114
+ '1.2.1': ('A', {
115
+ 'es': ('Solo audio y solo vídeo (pregrabado)', 'El audio tiene transcripción; el vídeo sin audio, alternativa textual.', 'Podcasts without transcripts; silent demonstration videos without text description.', 'Manual: play the media and check an alternative exists.'),
116
+ 'en': ('Audio-only and Video-only (Prerecorded)', 'Audio-only content has a transcript; video-only has a text or audio alternative.', 'Podcasts without transcripts; silent demonstration videos without text description.', 'Manual: play the media and check an alternative exists.'),
117
+ }),
118
+ '1.4.10': ('AA', {
119
+ 'es': ('Reflujo', 'El contenido refluye a 320px CSS sin scroll bidimensional.', 'Fixed-width layouts that force horizontal scrolling on phones.', 'a11y_reflow (320px viewport, real overflow measurement + offenders).'),
120
+ 'en': ('Reflow', 'Content reflows to 320 CSS px without two-dimensional scroll.', 'Fixed-width layouts that force horizontal scrolling on phones.', 'a11y_reflow (320px viewport, real overflow measurement + offenders).'),
121
+ }),
122
+ '1.4.12': ('AA', {
123
+ 'es': ('Espaciado de texto', 'Sin pérdida de contenido con los overrides de espaciado oficiales.', 'Cards with fixed heights that clip their text when spacing grows.', 'a11y_audit_dom (injects the official override set and counts clipped texts).'),
124
+ 'en': ('Text Spacing', 'No loss of content when users apply the documented spacing overrides (line-height 1.5, letter-spacing 0.12em…)', 'Cards with fixed heights that clip their text when spacing grows.', 'a11y_audit_dom (injects the official override set and counts clipped texts).'),
125
+ }),
126
+ '1.4.13': ('AA', {
127
+ 'es': ('Contenido al pasar el foco o el puntero', 'El contenido emergente se puede cerrar, alcanzar y persiste.', 'Tooltips that vanish when you move toward them; hovers you cannot dismiss with Esc.', 'Manual: hover/focus each trigger, try Esc, try moving to the tooltip.'),
128
+ 'en': ('Content on Hover or Focus', 'Hover/focus-triggered content is dismissible, hoverable and persistent.', 'Tooltips that vanish when you move toward them; hovers you cannot dismiss with Esc.', 'Manual: hover/focus each trigger, try Esc, try moving to the tooltip.'),
129
+ }),
130
+ '2.1.2': ('A', {
131
+ 'es': ('Sin trampa de teclado', 'El foco siempre puede salir solo con teclado.', 'Modals whose focus cycles forever with no Escape release.', 'a11y_keyboard (real Tab walk, cycle detection, Escape-release test).'),
132
+ 'en': ('No Keyboard Trap', 'Focus can always leave a component with the keyboard alone.', 'Modals whose focus cycles forever with no Escape release.', 'a11y_keyboard (real Tab walk, cycle detection, Escape-release test).'),
133
+ }),
134
+ '2.5.7': ('AA', {
135
+ 'es': ('Movimientos de arrastre', 'Toda acción de arrastre tiene alternativa sin arrastre.', 'Sliders you can only drag; kanban cards you can only drag-and-drop.', 'Manual: try every action with click/tap only; a11y_audit_url flags drag-handler suspicion.'),
136
+ 'en': ('Dragging Movements', 'Dragging operations have a non-dragging alternative.', 'Sliders you can only drag; kanban cards you can only drag-and-drop.', 'Manual: try every action with click/tap only; a11y_audit_url flags drag-handler suspicion.'),
137
+ }),
138
+ '1.4.5': ('AA', {
139
+ 'es': ('Imágenes de texto', 'Salvo logotipos, el texto se presenta como texto real, no como imagen.', 'Headings or paragraphs rendered as PNG/JPG; banner text baked into hero images.', 'a11y_audit_url flags images inside headings and book-length alts (review signal); you judge whether each image of text is justified (logo exception).'),
140
+ 'en': ('Images of Text', 'Except for logotypes, text is presented as real text, not images of text.', 'Headings or paragraphs rendered as PNG/JPG; banner text baked into hero images.', 'a11y_audit_url flags images inside headings and book-length alts (review signal); you judge whether each image of text is justified (logo exception).'),
141
+ }),
142
+ '1.4.11': ('AA', {
143
+ 'es': ('Contraste no textual', 'Componentes UI y objetos gráficos tienen al menos 3:1 contra colores adyacentes.', 'Icon buttons barely visible against their background; focus indicators too faint to see.', 'a11y_contrast_pair with target 3.0 for UI elements; the rendered audit checks focus-indicator contrast; you verify visually.'),
144
+ 'en': ('Non-text Contrast', 'UI components and graphical objects have at least 3:1 contrast against adjacent colors.', 'Icon buttons barely visible against their background; focus indicators too faint to see.', 'a11y_contrast_pair with target 3.0 for UI elements; the rendered audit checks focus-indicator contrast; you verify visually.'),
145
+ }),
146
+ '3.2.6': ('A', {
147
+ 'es': ('Ayuda coherente — NUEVO en 2.2', 'Si hay ayuda en varias páginas, aparece en el mismo orden relativo.', 'A "Contact us" link in the header on some pages and the footer on others.', 'a11ytoolkit audit --pages N (site-level help-link drift detection across the crawl).'),
148
+ 'en': ('Consistent Help — NEW in WCAG 2.2', 'If help is available on multiple pages, it appears in the same relative order.', 'A "Contact us" link in the header on some pages and the footer on others.', 'a11ytoolkit audit --pages N (site-level help-link drift detection across the crawl).'),
149
+ }),
150
+ '1.1.1': ('A', {
151
+ 'es': ('Contenido no textual',
152
+ 'Toda imagen funcional o informativa tiene alternativa textual equivalente; las decorativas se ocultan (alt="").',
153
+ '<img> sin alt, botones-imagen sin nombre, mapas sin texto alternativo, canvas/svg sin nombre accesible.',
154
+ 'a11y_audit_url / a11y_audit_dom (faltantes); tú valoras si el texto describe el contenido.'),
155
+ 'en': ('Non-text Content',
156
+ 'Every functional or informative image has an equivalent text alternative; decorative ones are hidden (alt="").',
157
+ '<img> without alt, image buttons with no name, maps without text alternative, canvas/svg with no accessible name.',
158
+ 'a11y_audit_url / a11y_audit_dom (missing ones); you judge whether the text describes the content.'),
159
+ }),
160
+ '1.2.2': ('A', {
161
+ 'es': ('Subtítulos (pregrabado)',
162
+ 'Los vídeos con audio pregrabado publican subtítulos sincronizados.',
163
+ 'Vídeos de marketing, demos o tutoriales sin <track kind="captions">.',
164
+ 'a11y_audit_url / a11y_audit_dom (detección); tú validas la calidad de los subtítulos.'),
165
+ 'en': ('Captions (Prerecorded)',
166
+ 'Videos with prerecorded audio publish synchronized captions.',
167
+ 'Marketing, demo or tutorial videos without <track kind="captions">.',
168
+ 'a11y_audit_url / a11y_audit_dom (detection); you validate caption quality.'),
169
+ }),
170
+ '1.3.1': ('A', {
171
+ 'es': ('Información y relaciones',
172
+ 'La estructura visual es programática: encabezados jerárquicos, tablas con th/scope, landmarks, labels asociados.',
173
+ 'Saltos de nivel de encabezados, tablas sin th, encabezados vacíos, múltiples h1, landmarks duplicados sin nombre.',
174
+ 'a11y_audit_url / a11y_audit_dom (estructura); tú juzgas si el esquema tiene sentido.'),
175
+ 'en': ('Info and Relationships',
176
+ 'The visual structure is programmatic: hierarchical headings, tables with th/scope, landmarks, associated labels.',
177
+ 'Heading level skips, tables without th, empty headings, multiple h1, duplicated unnamed landmarks.',
178
+ 'a11y_audit_url / a11y_audit_dom (structure); you judge whether the outline makes sense.'),
179
+ }),
180
+ '1.3.5': ('AA', {
181
+ 'es': ('Identificar el propósito de la entrada',
182
+ 'Los campos que recogen datos de la persona usuaria declaran su propósito con autocomplete (email, tel, name…).',
183
+ 'Campos de contacto/registro sin atributo autocomplete.',
184
+ 'a11y_audit_url / a11y_audit_dom (detección de campos sin autocomplete).'),
185
+ 'en': ('Identify Input Purpose',
186
+ 'Fields collecting user information declare their purpose via autocomplete (email, tel, name…).',
187
+ 'Contact/signup fields without the autocomplete attribute.',
188
+ 'a11y_audit_url / a11y_audit_dom (detection of fields without autocomplete).'),
189
+ }),
190
+ '1.4.2': ('A', {
191
+ 'es': ('Control del audio',
192
+ 'El audio que suena solo más de 3 segundos se puede pausar/parar o ajustar su volumen sin bajar el global.',
193
+ '<video>/<audio> con autoplay y sonido.',
194
+ 'a11y_audit_url / a11y_audit_dom (detección de autoplay); tú compruebas que el control exista y funcione.'),
195
+ 'en': ('Audio Control',
196
+ 'Audio playing automatically for more than 3 seconds can be paused/stopped or volume-controlled without lowering the global volume.',
197
+ '<video>/<audio> with autoplay and sound.',
198
+ 'a11y_audit_url / a11y_audit_dom (autoplay detection); you verify a working control exists.'),
199
+ }),
200
+ '1.4.3': ('AA', {
201
+ 'es': ('Contraste (mínimo)',
202
+ 'Texto normal ≥4.5:1, texto grande (≥24px o ≥18.66px negrita) ≥3:1 contra su fondo efectivo.',
203
+ 'Colores corporativos claros sobre blanco, texto sobre fotos y degradados, placeholders grises.',
204
+ 'a11y_contrast_pair (pares), a11y_contrast_image (sobre imagen), a11y_audit_dom (computado en toda la página).'),
205
+ 'en': ('Contrast (Minimum)',
206
+ 'Normal text ≥4.5:1, large text (≥24px or ≥18.66px bold) ≥3:1 against its effective background.',
207
+ 'Light brand colors on white, text over photos and gradients, gray placeholders.',
208
+ 'a11y_contrast_pair (pairs), a11y_contrast_image (over images), a11y_audit_dom (computed page-wide).'),
209
+ }),
210
+ '1.4.4': ('AA', {
211
+ 'es': ('Cambio de tamaño del texto',
212
+ 'El texto se puede ampliar al 200% sin pérdida de contenido o funcionalidad.',
213
+ 'viewport con user-scalable=no o maximum-scale<2, textos en píxeles fijos dentro de contenedores rígidos.',
214
+ 'a11y_audit_url / a11y_audit_dom (viewport); tú haces zoom 200% y compruebas reflujo.'),
215
+ 'en': ('Resize Text',
216
+ 'Text can be resized up to 200% without loss of content or functionality.',
217
+ 'viewport with user-scalable=no or maximum-scale<2, fixed-px text inside rigid containers.',
218
+ 'a11y_audit_url / a11y_audit_dom (viewport); you zoom to 200% and check reflow.'),
219
+ }),
220
+ '2.1.1': ('A', {
221
+ 'es': ('Teclado',
222
+ 'Toda funcionalidad es operable solo con teclado.',
223
+ 'onclick en div/span sin focus, menús y carruseles sin manejo de teclas, atajos accesskey duplicados.',
224
+ 'a11y_audit_url (onclick suelto, accesskey); tú recorres la página entera con Tab/Enter/Esc.'),
225
+ 'en': ('Keyboard',
226
+ 'All functionality is operable through a keyboard interface.',
227
+ 'onclick on div/span without focus handling, menus/carousels without key handling, duplicated accesskeys.',
228
+ 'a11y_audit_url (loose onclick, accesskey); you walk the whole page with Tab/Enter/Esc.'),
229
+ }),
230
+ '2.2.1': ('A', {
231
+ 'es': ('Tiempo ajustable',
232
+ 'Los límites de tiempo se pueden ampliar, desactivar o extender; nada se recarga sin petición.',
233
+ '<meta http-equiv="refresh"> temporizado, sesiones que caducan sin avisar.',
234
+ 'a11y_audit_url / a11y_audit_dom (meta refresh).'),
235
+ 'en': ('Timing Adjustable',
236
+ 'Time limits can be turned off, adjusted or extended; nothing reloads unless requested.',
237
+ 'Timed <meta http-equiv="refresh">, sessions expiring without warning.',
238
+ 'a11y_audit_url / a11y_audit_dom (meta refresh).'),
239
+ }),
240
+ '2.4.1': ('A', {
241
+ 'es': ('Evitación de bloques',
242
+ 'Hay mecanismo para saltar bloques de contenido que se repiten (skip link, landmarks).',
243
+ 'Sin <main>/role="main" ni enlace "saltar al contenido".',
244
+ 'a11y_audit_url / a11y_audit_dom (detección).'),
245
+ 'en': ('Bypass Blocks',
246
+ 'A mechanism exists to skip blocks of repeated content (skip link, landmarks).',
247
+ 'No <main>/role="main" and no "skip to content" link.',
248
+ 'a11y_audit_url / a11y_audit_dom (detection).'),
249
+ }),
250
+ '2.4.2': ('A', {
251
+ 'es': ('Página con título',
252
+ 'Cada página tiene un <title> descriptivo y único.',
253
+ 'Title vacío o genérico ("Inicio" en todas las páginas).',
254
+ 'a11y_audit_url / a11y_audit_dom (detección); tú valoras si describe la página.'),
255
+ 'en': ('Page Titled',
256
+ 'Every page has a descriptive, unique <title>.',
257
+ 'Empty or generic titles ("Home" everywhere).',
258
+ 'a11y_audit_url / a11y_audit_dom (detection); you judge whether it describes the page.'),
259
+ }),
260
+ '2.4.3': ('A', {
261
+ 'es': ('Orden del foco',
262
+ 'El orden de tabulación sigue el orden lógico de lectura y uso.',
263
+ 'tabindex positivos, DOM reordenado con CSS que rompe la secuencia.',
264
+ 'a11y_snapshot (orden REAL de tabulación) + a11y_diff entre builds; tabindex en el auditor estático.'),
265
+ 'en': ('Focus Order',
266
+ 'Focus order follows the logical reading and usage sequence.',
267
+ 'Positive tabindex, CSS-reordered DOM breaking the sequence.',
268
+ 'a11y_snapshot (REAL tab order) + a11y_diff between builds; tabindex in the static auditor.'),
269
+ }),
270
+ '2.4.4': ('A', {
271
+ 'es': ('Propósito de los enlaces (en contexto)',
272
+ 'El destino de cada enlace es comprensible por su texto (o su contexto programático).',
273
+ '«Más», «aquí», «leer más» repetidos; enlaces distintos con idéntico texto.',
274
+ 'a11y_audit_url (texto genérico y colisiones de nombre).'),
275
+ 'en': ('Link Purpose (In Context)',
276
+ 'Each link\'s destination is clear from its text (or programmatic context).',
277
+ '"More", "here", "read more" repeated; different links with identical text.',
278
+ 'a11y_audit_url (generic text and name collisions).'),
279
+ }),
280
+ '2.4.7': ('AA', {
281
+ 'es': ('Foco visible',
282
+ 'El indicador de foco del teclado es visible en todos los elementos enfocables.',
283
+ 'outline:none sin sustituto, indicadores con contraste insuficiente.',
284
+ 'a11y_audit_dom (heurística outline/box-shadow); tú confirmas visualmente cada parada de Tab.'),
285
+ 'en': ('Focus Visible',
286
+ 'The keyboard focus indicator is visible on every focusable element.',
287
+ 'outline:none with no replacement, indicators with insufficient contrast.',
288
+ 'a11y_audit_dom (outline/box-shadow heuristic); you visually confirm each Tab stop.'),
289
+ }),
290
+ '2.5.8': ('AA', {
291
+ 'es': ('Tamaño del objetivo (mínimo) — NUEVO en WCAG 2.2',
292
+ 'Los objetivos de puntero (botones, enlaces) miden al menos 24×24 px CSS, o tienen espaciado suficiente.',
293
+ 'Iconos-boton de 16px, enlaces apretados en menús de pie de página.',
294
+ 'a11y_audit_dom (getBoundingClientRect, con excepciones: enlaces inline equivalentes).'),
295
+ 'en': ('Target Size (Minimum) — NEW in WCAG 2.2',
296
+ 'Pointer targets (buttons, links) are at least 24×24 CSS px, or have sufficient spacing.',
297
+ '16px icon buttons, cramped footer-menu links.',
298
+ 'a11y_audit_dom (getBoundingClientRect, with exceptions: equivalent inline links).'),
299
+ }),
300
+ '3.1.1': ('A', {
301
+ 'es': ('Idioma de la página',
302
+ '<html> declara el idioma real de la página (código BCP-47).',
303
+ 'lang ausente o inválido ("xx"); lectores eligen la voz sintética equivocada.',
304
+ 'a11y_audit_url / a11y_audit_dom (detección + validez).'),
305
+ 'en': ('Language of Page',
306
+ '<html> declares the page\'s real language (BCP-47 code).',
307
+ 'Missing or invalid lang ("xx"); screen readers pick the wrong synthetic voice.',
308
+ 'a11y_audit_url / a11y_audit_dom (detection + validity).'),
309
+ }),
310
+ '3.2.5': ('AAA', {
311
+ 'es': ('Cambio a petición',
312
+ 'No hay cambios de contexto (ventanas nuevas, recargas) sin aviso o petición de la persona usuaria.',
313
+ 'target="_blank" sin avisar, redirecciones automáticas.',
314
+ 'a11y_audit_url (target=_blank sin aviso, meta refresh).'),
315
+ 'en': ('Change on Request',
316
+ 'No context changes (new windows, reloads) without notice or user request.',
317
+ 'target="_blank" without warning, automatic redirects.',
318
+ 'a11y_audit_url (target=_blank without warning, meta refresh).'),
319
+ }),
320
+ '3.3.2': ('A', {
321
+ 'es': ('Etiquetas o instrucciones',
322
+ 'Los campos tienen etiqueta visible o nombre accesible; las instrucciones están disponibles.',
323
+ 'input/select/textarea sin label ni aria-label, labels huérfanos, doble etiqueta.',
324
+ 'a11y_audit_url / a11y_audit_dom (detección).'),
325
+ 'en': ('Labels or Instructions',
326
+ 'Fields have visible labels or accessible names; instructions are available.',
327
+ 'input/select/textarea without label or aria-label, orphan labels, double labels.',
328
+ 'a11y_audit_url / a11y_audit_dom (detection).'),
329
+ }),
330
+ '2.5.2': ('A', {
331
+ 'es': ('Cancelación del puntero',
332
+ 'La activación se produce en el UP-event (o se puede abortar antes de completar).',
333
+ 'Lógica de activación en onmousedown/ontouchstart/onpointerdown: arrastrar el dedo fuera no cancela.',
334
+ 'a11y_audit_url (sospecha: manejadores en down-event); tú verificas el comportamiento.'),
335
+ 'en': ('Pointer Cancellation',
336
+ 'Activation happens on the up-event (or can be aborted before completion).',
337
+ 'Activation logic in onmousedown/ontouchstart/onpointerdown: dragging away does not abort.',
338
+ 'a11y_audit_url (suspicion: down-event handlers); you verify the behavior.'),
339
+ }),
340
+ '2.5.3': ('A', {
341
+ 'es': ('Etiqueta en el nombre',
342
+ 'El nombre accesible CONTIENE el texto de la etiqueta visible.',
343
+ 'aria-label que no incluye el texto visible: quien dicta por voz dice «Ver ofertas» y el control se llama «Más información».',
344
+ 'a11y_audit_url / a11y_audit_dom (detección).'),
345
+ 'en': ('Label in Name',
346
+ 'The accessible name CONTAINS the visible label text.',
347
+ 'aria-label that excludes the visible text: voice users say "View offers" but the control is named "More information".',
348
+ 'a11y_audit_url / a11y_audit_dom (detection).'),
349
+ }),
350
+ '3.1.2': ('AA', {
351
+ 'es': ('Idioma de las partes',
352
+ 'Pasajes en otro idioma llevan lang con código BCP-47 válido.',
353
+ 'Citas o términos extranjeros sin lang, o con código inválido.',
354
+ 'a11y_audit_url (validez de los lang de elementos).'),
355
+ 'en': ('Language of Parts',
356
+ 'Passages in another language carry lang with a valid BCP-47 code.',
357
+ 'Foreign quotes or terms without lang, or with invalid codes.',
358
+ 'a11y_audit_url (element lang validity).'),
359
+ }),
360
+ '3.3.8': ('AA', {
361
+ 'es': ('Autenticación accesible — NUEVO en WCAG 2.2',
362
+ 'El acceso no exige test cognitivo (recordar, resolver puzles): hay alternativa.',
363
+ 'CAPTCHA (reCAPTCHA, hCaptcha, Turnstile) sin alternativa: email mágico, OAuth, soporte.',
364
+ 'a11y_audit_url (detección de captcha); la alternativa se verifica a mano.'),
365
+ 'en': ('Accessible Authentication — NEW in WCAG 2.2',
366
+ 'Access does not require a cognitive test (remembering, puzzles): an alternative exists.',
367
+ 'CAPTCHA (reCAPTCHA, hCaptcha, Turnstile) with no alternative: magic links, OAuth, support.',
368
+ 'a11y_audit_url (captcha detection); the alternative is verified manually.'),
369
+ }),
370
+ '2.4.11': ('AA', {
371
+ 'es': ('Foco no ocultado (mínimo) — NUEVO en WCAG 2.2',
372
+ 'El elemento con foco no queda tapado por contenido del propio autor (cabeceras fijas, banners).',
373
+ 'Header sticky sin scroll-padding-top: anclajes y saltos de foco aterrizan bajo él.',
374
+ 'a11y_audit_dom (causa raíz: altura del fijo vs scroll-padding-top).'),
375
+ 'en': ('Focus Not Obscured (Minimum) — NEW in WCAG 2.2',
376
+ 'The focused element is not hidden by author content (sticky headers, banners).',
377
+ 'Sticky header without scroll-padding-top: anchors and focus jumps land beneath it.',
378
+ 'a11y_audit_dom (root cause: fixed height vs scroll-padding-top).'),
379
+ }),
380
+ '2.2.2': ('A', {
381
+ 'es': ('Poner en pausa, detener, ocultar',
382
+ 'El contenido en movimiento >5s se puede pausar, detener u ocultar.',
383
+ '<marquee>, looping CSS animations, auto-updating tickers with no pause control.',
384
+ 'a11y_audit_url / a11y_audit_dom (detection); you verify a pause control actually exists and works.'),
385
+ 'en': ('Pause, Stop, Hide',
386
+ 'Moving, blinking or auto-updating content that starts automatically and lasts >5s can be paused, stopped or hidden',
387
+ '<marquee>, looping CSS animations, auto-updating tickers with no pause control.',
388
+ 'a11y_audit_url / a11y_audit_dom (detection); you verify a pause control actually exists and works.'),
389
+ }),
390
+ '2.5.1': ('A', {
391
+ 'es': ('Gestos de puntero',
392
+ 'Todo gesto complejo tiene alternativa de clic/toque simple.',
393
+ 'Swipe carousels with no prev/next buttons; drag-to-reorder with no menu alternative.',
394
+ 'a11y_audit_url (touch/drag handler suspicion); you test with single clicks only.'),
395
+ 'en': ('Pointer Gestures',
396
+ 'Multipoint or path-based gestures have a single-pointer alternative (tap/click).',
397
+ 'Swipe carousels with no prev/next buttons; drag-to-reorder with no menu alternative.',
398
+ 'a11y_audit_url (touch/drag handler suspicion); you test with single clicks only.'),
399
+ }),
400
+ '2.5.4': ('A', {
401
+ 'es': ('Activación por movimiento',
402
+ 'Lo que activa el movimiento del dispositivo se activa también con UI y se puede desactivar.',
403
+ 'Shake-to-undo, tilt-to-scroll with no button alternative.',
404
+ 'a11y_audit_url (devicemotion/orientation handler suspicion); you verify the UI alternative actually works.'),
405
+ 'en': ('Motion Actuation',
406
+ 'Functions triggered by device motion can also be triggered by UI, and the motion trigger can be disabled.',
407
+ 'Shake-to-undo, tilt-to-scroll with no button alternative.',
408
+ 'a11y_audit_url (devicemotion/orientation handler suspicion); you verify the UI alternative actually works.'),
409
+ }),
410
+ '1.4.1': ('A', {
411
+ 'es': ('Uso del color',
412
+ 'El color nunca es el único medio visual de transmitir información.',
413
+ 'Links inside prose distinguished only by a slightly different color; "fields in red are required" alone fails the criterion.',
414
+ 'a11y_audit_dom (link-in-text-block color/underline check); you scan the page for color-only links by eye.'),
415
+ 'en': ('Use of Color',
416
+ 'Color is never the only visual means of conveying information.',
417
+ 'Links inside prose distinguished only by a slightly different color; "fields in red are required" alone fails the criterion.',
418
+ 'a11y_audit_dom (link-in-text-block color/underline check); you scan the page for color-only links by eye.'),
419
+ }),
420
+ '1.3.2': ('A', {
421
+ 'es': ('Secuencia significativa',
422
+ 'El orden de lectura del código coincide con el visual.',
423
+ 'CSS flex/grid order or absolute positioning that contradicts DOM order.',
424
+ 'a11y_audit_dom (DOM-vs-visual inversion heuristic); you confirm with a Tab walk.'),
425
+ 'en': ('Meaningful Sequence',
426
+ 'The reading order in code matches the visual presentation order.',
427
+ 'CSS flex/grid order or absolute positioning that contradicts DOM order.',
428
+ 'a11y_audit_dom (DOM-vs-visual inversion heuristic); you confirm with a Tab walk.'),
429
+ }),
430
+ '1.3.3': ('A', {
431
+ 'es': ('Características sensoriales',
432
+ 'Las instrucciones no dependen solo de forma/posición/tamaño.',
433
+ '"Click the round button on the right"; "see the instructions above".',
434
+ 'a11y_audit_url (text pattern review); you judge whether the reference is unambiguous.'),
435
+ 'en': ('Sensory Characteristics',
436
+ 'Instructions do not rely on shape, size, position or orientation alone.',
437
+ '"Click the round button on the right"; "see the instructions above".',
438
+ 'a11y_audit_url (text pattern review); you judge whether the reference is unambiguous.'),
439
+ }),
440
+ '1.3.4': ('AA', {
441
+ 'es': ('Orientación',
442
+ 'El contenido no se limita a una sola orientación salvo excepción.',
443
+ 'screen.orientation.lock() calls; orientation-forcing media queries.',
444
+ 'a11y_audit_url (lock detection); you test portrait and landscape.'),
445
+ 'en': ('Orientation',
446
+ 'Content does not restrict operation to a single orientation unless essential.',
447
+ 'screen.orientation.lock() calls; orientation-forcing media queries.',
448
+ 'a11y_audit_url (lock detection); you test portrait and landscape.'),
449
+ }),
450
+ '1.2.3': ('A', {
451
+ 'es': ('Audiodescripción o alternativa media',
452
+ 'El vídeo pregrabado tiene audiodescripción o alternativa.',
453
+ 'Videos with essential visual information and no descriptions track.',
454
+ 'a11y_audit_url (track absence); a human watching the video decides if description is needed.'),
455
+ 'en': ('Audio Description or Media Alternative',
456
+ 'Prerecorded video has audio description or a media alternative.',
457
+ 'Videos with essential visual information and no descriptions track.',
458
+ 'a11y_audit_url (track absence); a human watching the video decides if description is needed.'),
459
+ }),
460
+ '1.2.5': ('AA', {
461
+ 'es': ('Audiodescripción (pregrabado)',
462
+ 'El vídeo pregrabado lleva audiodescripción sincronizada.',
463
+ 'Same as 1.2.3 at AA level.',
464
+ 'a11y_audit_url (track kind="descriptions" absence); human judgment required.'),
465
+ 'en': ('Audio Description (Prerecorded)',
466
+ 'Prerecorded video carries synchronized audio description.',
467
+ 'Same as 1.2.3 at AA level.',
468
+ 'a11y_audit_url (track kind="descriptions" absence); human judgment required.'),
469
+ }),
470
+ '3.2.3': ('AA', {
471
+ 'es': ('Navegación coherente',
472
+ 'La navegación repetida mantiene el mismo orden relativo en todas las páginas.',
473
+ 'Menu items reordered or renamed between sections of the same site.',
474
+ 'a11ytoolkit audit --pages N (site-level nav-signature comparison); you review the diff.'),
475
+ 'en': ('Consistent Navigation',
476
+ 'Repeated navigation appears in the same relative order across pages.',
477
+ 'Menu items reordered or renamed between sections of the same site.',
478
+ 'a11ytoolkit audit --pages N (site-level nav-signature comparison); you review the diff.'),
479
+ }),
480
+ '3.2.4': ('AA', {
481
+ 'es': ('Identificación coherente',
482
+ 'Lo que funciona igual se identifica igual en todo el sitio.',
483
+ 'A search icon labelled "Search" on one page and "Find" on another.',
484
+ 'Site-level pass (same crawl); you compare accessible names across pages.'),
485
+ 'en': ('Consistent Identification',
486
+ 'Components with the same functionality are identified consistently.',
487
+ 'A search icon labelled "Search" on one page and "Find" on another.',
488
+ 'Site-level pass (same crawl); you compare accessible names across pages.'),
489
+ }),
490
+ '2.4.5': ('AA', {
491
+ 'es': ('Múltiples vías',
492
+ 'Hay al menos dos formas de encontrar cada página.',
493
+ 'Sites where the only path to content is one deep menu.',
494
+ 'a11ytoolkit audit --pages N (search input / sitemap link detection across the crawl).'),
495
+ 'en': ('Multiple Ways',
496
+ 'At least two ways exist to find any page (nav + search/sitemap).',
497
+ 'Sites where the only path to content is one deep menu.',
498
+ 'a11ytoolkit audit --pages N (search input / sitemap link detection across the crawl).'),
499
+ }),
500
+ '1.2.4': ('AA', {
501
+ 'es': ('Subtítulos (directo)',
502
+ 'El audio en directo tiene subtítulos sincronizados.',
503
+ 'Live streams, webinars with no CART/captioning.',
504
+ 'Manual: attend the live session and verify captions exist.'),
505
+ 'en': ('Captions (Live)',
506
+ 'Live audio content has synchronized captions.',
507
+ 'Live streams, webinars with no CART/captioning.',
508
+ 'Manual: attend the live session and verify captions exist.'),
509
+ }),
510
+ '2.1.4': ('A', {
511
+ 'es': ('Atajos de carácter único',
512
+ 'Los atajos de una tecla se pueden desactivar o remapear.',
513
+ 'Pressing "s" anywhere triggers search while typing in a field.',
514
+ 'Manual: type single letters with focus inside inputs and outside.'),
515
+ 'en': ('Character Key Shortcuts',
516
+ 'Single-character shortcuts can be turned off, remapped, or active only on focus.',
517
+ 'Pressing "s" anywhere triggers search while typing in a field.',
518
+ 'Manual: type single letters with focus inside inputs and outside.'),
519
+ }),
520
+ '2.3.1': ('A', {
521
+ 'es': ('Tres destellos o menos',
522
+ 'Nada parpadea más de 3 veces por segundo.',
523
+ 'Videos, animations or GIFs with rapid strobe sections.',
524
+ 'Manual (frame-by-frame review); automated flash counting is not implemented anywhere honestly.'),
525
+ 'en': ('Three Flashes or Below Threshold',
526
+ 'Nothing flashes more than 3 times per second.',
527
+ 'Videos, animations or GIFs with rapid strobe sections.',
528
+ 'Manual (frame-by-frame review); automated flash counting is not implemented anywhere honestly.'),
529
+ }),
530
+ '2.4.6': ('AA', {
531
+ 'es': ('Encabezados y etiquetas',
532
+ 'Encabezados y etiquetas describen su tema o propósito.',
533
+ 'A heading that says "Section 2"; a form label that says "Field 1".',
534
+ 'a11ytoolkit checks structure (empty/skips); descriptiveness is human/agent judgment.'),
535
+ 'en': ('Headings and Labels',
536
+ 'Headings and labels describe their topic or purpose.',
537
+ 'A heading that says "Section 2"; a form label that says "Field 1".',
538
+ 'a11ytoolkit checks structure (empty/skips); descriptiveness is human/agent judgment.'),
539
+ }),
540
+ '3.2.1': ('A', {
541
+ 'es': ('Al recibir foco',
542
+ 'Recibir foco nunca cambia el contexto.',
543
+ 'Focus moving to a menu item navigates immediately.',
544
+ 'Manual: Tab through the page and watch for unexpected changes.'),
545
+ 'en': ('On Focus',
546
+ 'Receiving focus never triggers a context change (navigation, form submission).',
547
+ 'Focus moving to a menu item navigates immediately.',
548
+ 'Manual: Tab through the page and watch for unexpected changes.'),
549
+ }),
550
+ '3.2.2': ('A', {
551
+ 'es': ('Al recibir entrada',
552
+ 'Cambiar un ajuste nunca cambia el contexto automáticamente.',
553
+ 'Selecting from a select navigates without a Submit.',
554
+ 'Manual: interact with every control and watch for surprises.'),
555
+ 'en': ('On Input',
556
+ 'Changing a setting never changes context automatically.',
557
+ 'Selecting from a select navigates without a Submit.',
558
+ 'Manual: interact with every control and watch for surprises.'),
559
+ }),
560
+ '3.3.1': ('A', {
561
+ 'es': ('Identificación de errores',
562
+ 'Los errores se identifican y describen en texto.',
563
+ 'Forms that just border fields in red with no message.',
564
+ 'Manual/agent: submit invalid data and check the announced error.'),
565
+ 'en': ('Error Identification',
566
+ 'Input errors are identified in text, and described to the user.',
567
+ 'Forms that just border fields in red with no message.',
568
+ 'Manual/agent: submit invalid data and check the announced error.'),
569
+ }),
570
+ '3.3.3': ('AA', {
571
+ 'es': ('Sugerencia ante errores',
572
+ 'Los mensajes de error sugieren la corrección cuando se conoce.',
573
+ '"Invalid date" instead of "Use DD/MM/YYYY".',
574
+ 'Manual/agent: trigger errors and read the messages.'),
575
+ 'en': ('Error Suggestion',
576
+ 'Error messages suggest a correction when known.',
577
+ '"Invalid date" instead of "Use DD/MM/YYYY".',
578
+ 'Manual/agent: trigger errors and read the messages.'),
579
+ }),
580
+ '3.3.4': ('AA', {
581
+ 'es': ('Prevención de errores',
582
+ 'Envíos con consecuencias son reversibles, verificados o confirmados.',
583
+ 'Purchase buttons with no review step.',
584
+ 'Manual: walk the full transaction flow.'),
585
+ 'en': ('Error Prevention (Legal, Financial, Data)',
586
+ 'Submissions with legal/financial consequences are reversible, checked or confirmed.',
587
+ 'Purchase buttons with no review step.',
588
+ 'Manual: walk the full transaction flow.'),
589
+ }),
590
+ '3.3.7': ('A', {
591
+ 'es': ('Entrada redundante',
592
+ 'No se pide reescribir información ya dada.',
593
+ 'Multi-step forms asking for the email again.',
594
+ 'Manual/agent: walk multi-step flows.'),
595
+ 'en': ('Redundant Entry',
596
+ 'Information asked before is auto-filled or selectable, not retyped.',
597
+ 'Multi-step forms asking for the email again.',
598
+ 'Manual/agent: walk multi-step flows.'),
599
+ }),
600
+ '4.1.3': ('AA', {
601
+ 'es': ('Mensajes de estado',
602
+ 'Los mensajes de estado se anuncian sin mover el foco.',
603
+ 'Toasts, "saved" confirmations with no aria-live.',
604
+ 'a11y_aria_live_snippet (observe announcements); the scroll auditor checks feed loading announcements.'),
605
+ 'en': ('Status Messages',
606
+ 'Status messages are announced without moving focus.',
607
+ 'Toasts, "saved" confirmations with no aria-live.',
608
+ 'a11y_aria_live_snippet (observe announcements); the scroll auditor checks feed loading announcements.'),
609
+ }),
610
+ '4.1.2': ('A', {
611
+ 'es': ('Nombre, función, valor',
612
+ 'Controles y widgets exponen nombre, función y estado a tecnología asistida.',
613
+ 'Botones sin nombre, roles ARIA desconocidos, aria-labelledby roto, slider sin aria-valuenow, aria-hidden en enfocables.',
614
+ 'a11y_audit_url / a11y_audit_dom (detección); a11y_snapshot muestra los nombres reales.'),
615
+ 'en': ('Name, Role, Value',
616
+ 'Controls and widgets expose name, role and state to assistive technology.',
617
+ 'Buttons with no name, unknown ARIA roles, broken aria-labelledby, slider without aria-valuenow, aria-hidden on focusables.',
618
+ 'a11y_audit_url / a11y_audit_dom (detection); a11y_snapshot shows the real names.'),
619
+ }),
620
+
621
+ # ── AAA: la biblia completa (ingesta w3c/wcag 2026-10) ──────────────────
622
+ '1.2.6': ('AAA', {
623
+ 'es': ('Lengua de señas (pregrabado)', 'El vídeo pregrabado ofrece interpretación en lengua de señas.', 'Vídeos con subtítulos pero sin interpretación en señas.', 'Manual: verificar que existe la pista o ventana de lengua de señas.'),
624
+ 'en': ('Sign Language (Prerecorded)', 'Prerecorded video provides sign language interpretation.', 'Videos with captions but no sign language interpretation.', 'Manual: verify a sign language track or window exists.'),
625
+ }),
626
+ '1.2.7': ('AAA', {
627
+ 'es': ('Audiodescripción extendida (pregrabado)', 'La audiodescripción extendida pausa el vídeo cuando hace falta más tiempo.', 'Audiodescripción que se corta porque el vídeo no hace pausas.', 'Manual: reproducir y comprobar que la descripción completa cabe.'),
628
+ 'en': ('Extended Audio Description (Prerecorded)', 'Extended audio description pauses the video when more time is needed.', 'Audio description cut off because the video never pauses.', 'Manual: play and check the full description fits.'),
629
+ }),
630
+ '1.2.8': ('AAA', {
631
+ 'es': ('Alternativa medial (pregrabado)', 'Toda película pregrabada tiene transcripción textual completa que describe la acción.', 'Vídeos largos sin transcripción descriptiva.', 'Manual: verificar la transcripción y que describe lo esencial visual.'),
632
+ 'en': ('Media Alternative (Prerecorded)', 'Every prerecorded movie has a full text transcript describing the action.', 'Long videos without a descriptive transcript.', 'Manual: verify the transcript describes the essential visuals.'),
633
+ }),
634
+ '1.2.9': ('AAA', {
635
+ 'es': ('Solo audio (en directo)', 'La transmisión de audio en directo tiene transcripción o equivalente textual.', 'Directos y webinars sin subtítulos ni transcripción en vivo.', 'Manual: verificar la transcripción en vivo o su equivalente.'),
636
+ 'en': ('Audio-only (Live)', 'Live audio streams provide a transcript or text alternative.', 'Live events and webinars without live captions or transcript.', 'Manual: verify live transcription or its equivalent.'),
637
+ }),
638
+ '1.3.6': ('AAA', {
639
+ 'es': ('Identificar el propósito', 'El propósito de los controles comunes se puede determinar programáticamente (personalización).', 'Controles sin semántica que impiden la personalización por el usuario.', 'a11y_audit_url (roles/estructura) + manual: contrastar con los purposes de WCAG.'),
640
+ 'en': ('Identify Purpose', 'The purpose of common controls is programmatically determinable (personalization).', 'Controls without semantics blocking user-side customization.', 'a11y_audit_url (roles/structure) + manual: compare against WCAG purposes.'),
641
+ }),
642
+ '1.4.6': ('AAA', {
643
+ 'es': ('Contraste (mejorado)', 'Texto con ratio ≥ 7:1 (≥ 4,5:1 el grande).', 'Gris claro sobre blanco, textos de marca al límite.', 'a11y_contrast_pair con objetivo 7.0; a11y_contrast_dom / a11y_contrast_image en contexto real.'),
644
+ 'en': ('Contrast (Enhanced)', 'Text at ≥ 7:1 (≥ 4.5:1 large).', 'Light gray on white, brand colors at the edge.', 'a11y_contrast_pair with 7.0 target; a11y_contrast_dom / a11y_contrast_image in real context.'),
645
+ }),
646
+ '1.4.7': ('AAA', {
647
+ 'es': ('Audio de fondo bajo o nulo', 'El audio hablado tiene fondo ≤ 20 dB por debajo de la voz, o se puede apagar.', 'Música alta bajo una locución que no se puede silenciar.', 'Manual: medir o verificar el control de audio de fondo.'),
648
+ 'en': ('Low or No Background Audio', 'Speech audio has background ≥ 20 dB below the voice, or it can be turned off.', 'Loud music under narration with no way to mute it.', 'Manual: measure or verify the background-audio control.'),
649
+ }),
650
+ '1.4.8': ('AAA', {
651
+ 'es': ('Presentación visual', 'Bloques de texto: selección de colores, 80 columnas, reflujo, justificado no forzado, interlineado/espaciado ajustables.', 'Textos justificados a fuerza de hyphens, sin opciones de espaciado, columnas kilométricas.', 'Manual: probar el reflujo a 320px (a11y_reflow ayuda) y las preferencias de usuario.'),
652
+ 'en': ('Visual Presentation', 'Text blocks: color selectable, 80 columns, reflow, no forced justification, adjustable leading/spacing.', 'Force-justified text, no spacing options, kilometer-wide columns.', 'Manual: test reflow at 320px (a11y_reflow helps) and user preferences.'),
653
+ }),
654
+ '1.4.9': ('AAA', {
655
+ 'es': ('Imágenes de texto (sin excepción)', 'Texto como texto siempre — salvo esencial (logos) o decorativo.', 'Citas o párrafos enteros renderizados como imagen.', 'a11y_audit_url (images_of_text) + revisión visual de excepciones esenciales.'),
656
+ 'en': ('Images of Text (No Exception)', 'Text as text always — except essential (logos) or decorative.', 'Whole quotes or paragraphs rendered as images.', 'a11y_audit_url (images_of_text) + visual review of essential exceptions.'),
657
+ }),
658
+ '2.1.3': ('AAA', {
659
+ 'es': ('Teclado (sin excepción)', 'TODA la funcionalidad es operable por teclado, sin excepción de plataforma.', 'Widget que solo funciona con puntero en alguna plataforma.', 'a11y_keyboard (trampas) + recorrido manual completo por teclado.'),
660
+ 'en': ('Keyboard (No Exception)', 'ALL functionality is keyboard operable, with no platform exception.', 'A widget that only works with pointer on some platform.', 'a11y_keyboard (traps) + full manual keyboard walk.'),
661
+ }),
662
+ '2.2.3': ('AAA', {
663
+ 'es': ('Sin tiempos', 'Ni la interacción ni los eventos tienen límite de tiempo — ni siquiera ajustable.', 'Carrousels que avanzan solos sin control de pausa.', 'Manual: buscar todo avance/timeout automático; a11y_reduced_motion ayuda con animaciones.'),
664
+ 'en': ('No Timing', 'No interaction or event has a time limit — not even an adjustable one.', 'Carousels that auto-advance with no pause control.', 'Manual: hunt every auto-advance/timeout; a11y_reduced_motion helps with animation.'),
665
+ }),
666
+ '2.2.4': ('AAA', {
667
+ 'es': ('Interrupciones', 'Las interrupciones (avisos, actualizaciones) se pueden aplazar o suprimir.', 'Popups de chat que saltan sobre la tarea y no se silencian.', 'Manual: probar notificaciones y actualizaciones en contexto.'),
668
+ 'en': ('Interruptions', 'Interruptions (alerts, updates) can be postponed or suppressed.', 'Chat popups jumping over the task with no way to silence.', 'Manual: test notifications and updates in context.'),
669
+ }),
670
+ '2.2.5': ('AAA', {
671
+ 'es': ('Re-autenticación', 'Al re-autenticar tras expirar la sesión, no se pierde el estado ni los datos de la actividad.', 'Formularios que se vacían cuando caduca la sesión a mitad.', 'Manual: dejar caducar la sesión con un formulario a medias.'),
672
+ 'en': ('Re-authenticating', 'Re-authenticating after session expiry loses no activity data or state.', 'Forms wiped when the session expires mid-way.', 'Manual: let a half-filled form session expire.'),
673
+ }),
674
+ '2.2.6': ('AAA', {
675
+ 'es': ('Tiempos de espera', 'Se avisa de la duración de la inactividad que provoca pérdida de datos (salvo seguridad esencial).', 'Sesiones que caducan sin decir cuánto ni avisar.', 'Manual: revisar avisos de expiración y su antelación.'),
676
+ 'en': ('Timeouts', 'Users are warned of the inactivity duration that causes data loss (unless security-essential).', 'Sessions expiring with no duration info or warning.', 'Manual: review expiry notices and their lead time.'),
677
+ }),
678
+ '2.3.2': ('AAA', {
679
+ 'es': ('Tres destellos', 'Nada destella más de tres veces por segundo (umbral más estricto que 2.3.1).', 'Animaciones parpadeantes agresivas aunque "justo" bajo el umbral de 2.3.1.', 'Manual + análisis de la frecuencia de parpadeo del contenido.'),
680
+ 'en': ('Three Flashes', 'Nothing flashes more than three times per second (stricter threshold than 2.3.1).', 'Aggressive flashing animations "just" under the 2.3.1 threshold.', 'Manual + flash-frequency analysis of the content.'),
681
+ }),
682
+ '2.3.3': ('AAA', {
683
+ 'es': ('Animación por interacciones', 'La animación por interacción se puede desactivar (salvo esencial).', 'Parallax y efectos que siguen al scroll/puntero sin off.', 'a11y_reduced_motion (¿respeta prefers-reduced-motion?) + manual de la pausa.'),
684
+ 'en': ('Animation from Interactions', 'Motion from interaction can be disabled (unless essential).', 'Parallax and effects tracking scroll/pointer with no off switch.', 'a11y_reduced_motion (honors prefers-reduced-motion?) + manual pause check.'),
685
+ }),
686
+ '2.4.8': ('AAA', {
687
+ 'es': ('Ubicación', 'Hay información de la ubicación dentro del conjunto de páginas (breadcrumb o mapa).', 'Páginas profundas sin rastro de dónde estás.', 'Manual: verificar breadcrumb/mapa; a11y_audit_url detecta sitemap/enlaces de ayuda.'),
688
+ 'en': ('Location', 'Information about location within the page set exists (breadcrumb or sitemap).', 'Deep pages with no trace of where you are.', 'Manual: verify breadcrumb/sitemap; a11y_audit_url detects sitemap/help links.'),
689
+ }),
690
+ '2.4.9': ('AAA', {
691
+ 'es': ('Propósito del enlace (solo enlace)', 'El propósito se entiende SOLO con el texto del enlace, sin contexto.', '"Más", "aquí" como única pista incluso con contexto.', 'a11y_audit_url (generic_link / same_name_links) + revisión editorial.'),
692
+ 'en': ('Link Purpose (Link Only)', 'The purpose is understandable from the link text ALONE, no context.', '"More", "here" as the only hint even with context.', 'a11y_audit_url (generic_link / same_name_links) + editorial review.'),
693
+ }),
694
+ '2.4.10': ('AAA', {
695
+ 'es': ('Encabezados de sección', 'Las secciones van encabezadas (cuando la estructura lo permite).', 'Muros de texto sin encabezados por sección.', 'a11y_audit_url (heading_skips / no_headings) + revisión de estructura.'),
696
+ 'en': ('Section Headings', 'Sections begin with headings (where structure allows).', 'Walls of text with no per-section headings.', 'a11y_audit_url (heading_skips / no_headings) + structure review.'),
697
+ }),
698
+ '2.4.12': ('AAA', {
699
+ 'es': ('Foco no oscurecido (mejorado)', 'El foco nunca queda oculto por nada (umbral estricto del 2.4.11).', 'Banners/cookies que tapan el elemento enfocado.', 'a11y_audit_dom (focus_obscured 2.4.11) + recorrido manual estricto.'),
700
+ 'en': ('Focus Not Obscured (Enhanced)', 'Focus is never obscured by anything (strict version of 2.4.11).', 'Banners/cookies covering the focused element.', 'a11y_audit_dom (focus_obscured 2.4.11) + strict manual walk.'),
701
+ }),
702
+ '2.4.13': ('AAA', {
703
+ 'es': ('Apariencia del foco', 'El indicador de foco: ≥ 2px de perímetro, ≥ 3:1 de contraste, sin que el tamaño del encierre baje.', 'Focos de 1px casi invisibles o con cambio de color únicamente.', 'a11y_audit_dom (focus indicator) + medición manual fina.'),
704
+ 'en': ('Focus Appearance', 'Focus indicator: ≥ 2px perimeter, ≥ 3:1 contrast, no enclosure size drop.', '1px near-invisible focus or color-only change.', 'a11y_audit_dom (focus indicator) + fine manual measurement.'),
705
+ }),
706
+ '2.5.5': ('AAA', {
707
+ 'es': ('Tamaño del objetivo (mejorado)', 'Objetivos de puntero ≥ 44×44 CSS (con las excepciones del estándar).', 'Iconos de 16px pegados unos a otros.', 'a11y_audit_dom (target_small, umbral AA 24 — el AAA exige 44).'),
708
+ 'en': ('Target Size (Enhanced)', 'Pointer targets ≥ 44×44 CSS (with the standard exceptions).', '16px icons crammed together.', 'a11y_audit_dom (target_small, AA threshold 24 — AAA requires 44).'),
709
+ }),
710
+ '2.5.6': ('AAA', {
711
+ 'es': ('Mecanismos de entrada concurrentes', 'No restringir el uso de los mecanismos de entrada disponibles (salvo esencial).', 'Forzar a pantalla táctil cuando hay teclado/pointer.', 'Manual: probar entrada alternativa en cada plataforma.'),
712
+ 'en': ('Concurrent Input Mechanisms', 'Do not restrict use of available input mechanisms (unless essential).', 'Forcing touch when keyboard/pointer exist.', 'Manual: try an alternative input on each platform.'),
713
+ }),
714
+ '3.1.3': ('AAA', {
715
+ 'es': ('Palabras inusuales', 'Las palabras raras, jerga o idioms tienen explicación (glosario o en línea).', 'Jerga de sector sin glosario en una web pública.', 'Manual + revisión editorial; reading_level da el nivel de lectura del texto.'),
716
+ 'en': ('Unusual Words', 'Rare words, jargon or idioms are explained (glossary or inline).', 'Industry jargon with no glossary on a public site.', 'Manual + editorial review; reading_level gives the text reading level.'),
717
+ }),
718
+ '3.1.4': ('AAA', {
719
+ 'es': ('Abreviaturas', 'Las abreviaturas tienen expansión en su primera aparición (o un glosario).', 'Siglas internas sin expandir jamás.', 'Manual + revisión editorial de primeras apariciones.'),
720
+ 'en': ('Abbreviations', 'Abbreviations have an expansion at first use (or a glossary).', 'Internal acronyms never expanded.', 'Manual + editorial review of first occurrences.'),
721
+ }),
722
+ '3.1.5': ('AAA', {
723
+ 'es': ('Nivel de lectura', 'Suplementos de comprensión para contenido que exige nivel de lectura superior al inferior de secundaria.', 'Textos legales densos sin resumen en lenguaje claro.', 'reading_level (Fernández-Huerta/Flesch por página) para detectar densidad + redacción de suplementos.'),
724
+ 'en': ('Reading Level', 'Comprehension supplements when reading level exceeds lower secondary education.', 'Dense legal text with no plain-language summary.', 'reading_level (Fernández-Huerta/Flesch per page) to spot density + write supplements.'),
725
+ }),
726
+ '3.1.6': ('AAA', {
727
+ 'es': ('Pronunciación', 'Cuando el significado depende de la pronunciación, esta se determina programáticamente o por contexto.', 'Homógrafos chinos o puntuación hebrea sin marca de pronunciación.', 'Manual específico del idioma (idiomas con ambigüedad de pronunciación).'),
728
+ 'en': ('Pronunciation', 'Where meaning depends on pronunciation, it is programmatically or contextually determinable.', 'Chinese heteronyms or Hebrew punctuation without pronunciation marks.', 'Manual, language-specific (languages with pronunciation ambiguity).'),
729
+ }),
730
+ '3.3.5': ('AAA', {
731
+ 'es': ('Ayuda', 'Hay ayuda sensible al contexto para cada paso de un proceso.', 'Formularios complejos sin pista contextual en cada campo difícil.', 'Manual: revisar hints/contexto por paso; a11y_audit_url (help_inconsistent 3.2.6 relacionado).'),
732
+ 'en': ('Help', 'Context-sensitive help exists for each step of a process.', 'Complex forms with no contextual hint on each hard field.', 'Manual: review per-step hints; a11y_audit_url (related 3.2.6 help_inconsistent).'),
733
+ }),
734
+ '3.3.6': ('AAA', {
735
+ 'es': ('Prevención de errores (todos)', 'Toda sumisión reversible/verificable/corregible — para TODOS los formularios, no solo legales.', 'Cualquier formulario que confirma a ciegas.', 'Manual: recorrer todos los flujos de envío.'),
736
+ 'en': ('Error Prevention (All)', 'Every submission reversible/verifiable/correctable — for ALL forms, not just legal ones.', 'Any form that confirms blindly.', 'Manual: walk every submission flow.'),
737
+ }),
738
+ '3.3.9': ('AAA', {
739
+ 'es': ('Autenticación accesible (mejorado)', 'Sin prueba de función cognitiva NINGUNA en la autenticación (ni con alternativa: ninguna).', 'Captcha como único paso, sin excepción.', 'Manual del flujo de autenticación completo (registro, login, recuperación).'),
740
+ 'en': ('Accessible Authentication (Enhanced)', 'NO cognitive function test at all in authentication (no alternative-based exception either).', 'A captcha as the only step, no exception.', 'Manual review of the full authentication flow (signup, login, recovery).'),
741
+ }),
742
+ }
743
+
744
+ _LEVEL = {'A': 'A', 'AA': 'AA', 'AAA': 'AAA'}
745
+
746
+ # Human-effort class for every A/AA criterion — what the HUMAN still does after
747
+ # the machine's best signal. Used for review-marketplace pricing interlocks
748
+ # and emitted in the evidence pack matrix.
749
+ # MIN (1-3 min): the agent verified with a measured signal; the human reads and confirms.
750
+ # MED (5-10 min): the agent prepares context; the human verifies in the browser.
751
+ # MAX (15-30 min): real interaction, real judgment, real tooling.
752
+ # A not-flagged on a partially-covered criterion never earns a lower class:
753
+ # "the machine looked and found nothing" is weaker than a confirmation.
754
+ _EFFORT = {
755
+ '1.1.1': ('MIN', 'alt presence is measured; scan for the image the heuristic missed.'),
756
+ '1.2.2': ('MIN', 'caption track presence detected; confirm the captions are real.'),
757
+ '1.3.3': ('MIN', 'sensory-instruction phrases detected; read the instructions once.'),
758
+ '1.3.4': ('MIN', 'orientation-lock CSS/JS detected; confirm on a device.'),
759
+ '1.3.5': ('MIN', 'autocomplete token per input measured; confirm.'),
760
+ '1.4.2': ('MIN', 'autoplay-with-audio detected; confirm.'),
761
+ '1.4.4': ('MIN', 'viewport zoom block measured; confirm.'),
762
+ '2.2.1': ('MIN', 'meta refresh and timing scripts detected; confirm.'),
763
+ '2.4.1': ('MIN', 'missing main/skip detected; confirm.'),
764
+ '2.4.2': ('MIN', 'missing or empty title detected; confirm.'),
765
+ '2.4.3': ('MIN', 'positive tabindex detected; confirm.'),
766
+ '2.4.4': ('MIN', 'generic link text detected; read the links in context.'),
767
+ '2.5.2': ('MIN', 'down-event-only handlers detected; confirm.'),
768
+ '2.5.3': ('MIN', 'label-in-name mismatch computed; confirm.'),
769
+ '2.5.4': ('MIN', 'motion actuation without UI detected; confirm.'),
770
+ '3.1.1': ('MIN', 'page lang missing or invalid, measured; confirm.'),
771
+ '3.1.2': ('MIN', 'part lang invalid, measured; confirm.'),
772
+ '3.2.1': ('MIN', 'focus-triggered navigation detected; confirm.'),
773
+ '3.2.2': ('MIN', 'select-triggered navigation detected; confirm.'),
774
+ '3.2.6': ('MIN', 'help presence compared across crawled pages; confirm.'),
775
+ '3.3.2': ('MIN', 'placeholder-only and unlabeled required fields measured; read each label.'),
776
+ '3.3.8': ('MIN', 'captcha detected; confirm an alternative exists.'),
777
+ '4.1.2': ('MIN', 'invalid roles, broken refs and missing state measured; confirm.'),
778
+ '1.2.1': ('MED', 'media tags detected; play the media and judge the alternative.'),
779
+ '1.3.1': ('MED', 'semantic structure signals (fieldsets, heading skips, lists); navigate with a screen reader.'),
780
+ '1.3.2': ('MED', 'DOM vs visual order from snapshot and tab walk; spot-check layout exceptions.'),
781
+ '1.4.1': ('MED', 'link-vs-text color ratio computed; verify visually.'),
782
+ '1.4.5': ('MED', 'images-of-text candidates detected; judge logo and text exceptions.'),
783
+ '1.4.10': ('MED', '320px reflow measured with real overflow; navigate the reflowed content.'),
784
+ '1.4.11': ('MED', 'focus-indicator contrast computed; verify visually.'),
785
+ '1.4.12': ('MED', 'text-spacing overrides injected, clipping counted; verify.'),
786
+ '1.4.13': ('MED', 'hover + Escape dismissibility tested; verify.'),
787
+ '2.1.1': ('MED', 'click handlers on non-interactive elements detected; Tab the page.'),
788
+ '2.2.2': ('MED', 'looping animations computed; verify the pause control.'),
789
+ '2.4.5': ('MED', 'nav/sitemap/search presence from the crawl; confirm.'),
790
+ '2.4.6': ('MED', 'vague headings detected; read them in context.'),
791
+ '2.4.11': ('MED', 'sticky header vs scroll-padding measured; Tab the page.'),
792
+ '2.5.1': ('MED', 'gesture listeners without alternatives detected; try the gesture.'),
793
+ '2.5.7': ('MED', 'drag listeners detected; try the click path.'),
794
+ '2.5.8': ('MED', 'target rects measured; check the inline/equivalent exceptions.'),
795
+ '3.2.3': ('MED', 'nav consistency compared across crawled pages; confirm the order.'),
796
+ '3.2.4': ('MED', 'consistent identification compared across pages; confirm the icons.'),
797
+ '1.2.3': ('MAX', 'watch the media and judge whether an alternative covers essential visuals.'),
798
+ '1.2.4': ('MAX', 'live captions must be watched and judged; no honest signal.'),
799
+ '1.2.5': ('MAX', 'audio description requires watching and judging the video.'),
800
+ '1.4.3': ('MAX', 'computed ratios are evidence, not verdicts; gradients, images and hover states still need review.'),
801
+ '2.1.2': ('MAX', 'real Tab walk plus Escape test per modal and iframe.'),
802
+ '2.1.4': ('MAX', 'single-character shortcuts tested by typing in every field.'),
803
+ '2.3.1': ('MAX', 'flash threshold needs frame-by-frame analysis; no honest signal.'),
804
+ '2.4.7': ('MAX', 'focus visibility measured per stop; Tab the whole site.'),
805
+ '3.3.1': ('MAX', 'invalid submissions fired and the DOM judged; verify with a screen reader.'),
806
+ '3.3.3': ('MAX', 'read and judge each correction suggestion.'),
807
+ '3.3.4': ('MAX', 'reversible-transaction check requires walking the flow.'),
808
+ '3.3.7': ('MAX', 'redundant entry requires a remembered multi-step walk.'),
809
+ '4.1.3': ('MAX', 'fire each status message and listen for the announcement.'),
810
+ }
811
+
812
+ _EFFORT_MINUTES = {'MIN': (1, 3), 'MED': (5, 10), 'MAX': (15, 30)}
813
+
814
+ # Criterios A/AA que SOLO el modo renderizado puede medir (a11y_audit_dom):
815
+ # contraste computado, espaciado, tamaño de objetivo, foco, formularios vivos…
816
+ # El informe estático los declara en `not_measured` — un 100 estático jamás
817
+ # debe leerse como "contraste bien" (la limitación que la crítica externa
818
+ # destapó: .btn-primary{background:var(--x)} es invisible para el HTML puro).
819
+ RENDERED_ONLY = frozenset({
820
+ '1.3.2', '1.4.1', '1.4.3', '1.4.10', '1.4.11', '1.4.12', '1.4.13',
821
+ '2.1.2', '2.2.2', '2.4.7', '2.4.11', '2.5.8', '3.2.1', '3.2.2',
822
+ '3.3.1', '3.3.3', '4.1.3',
823
+ })
824
+
825
+
826
+
827
+ # Señal del motor → criterio WCAG que alimenta. Derivado empíricamente de los
828
+ # puntos de emisión (add/_add/_agrega y dicts _CRIT) — el test de invariantes
829
+ # re-deriva este mapa del código y compara: una señal nueva sin entrada falla.
830
+ _SIGNAL_CRIT = {
831
+ # — emisiones no derivables por regex (llamada multi-línea / clave variable) —
832
+ 'target_small': '2.5.8',
833
+ 'vtt_malformed': '1.2.2', 'vtt_no_cues': '1.2.2', 'vtt_empty_cue': '1.2.2',
834
+ 'vtt_overlap': '1.2.2', 'vtt_too_fast': '1.2.2', 'vtt_coverage': '1.2.2',
835
+ 'accesskey_dup': '2.1.1',
836
+ 'aria_hidden_focusable': '4.1.2',
837
+ 'aria_ref_missing': '4.1.2',
838
+ 'aria_value_invalid': '4.1.2',
839
+ 'audio_desc_missing': '1.2.3',
840
+ 'autocomplete': '1.3.5',
841
+ 'autocomplete_invalid': '1.3.5',
842
+ 'blank_no_warning': '3.2.5',
843
+ 'captcha': '3.3.8',
844
+ 'char_shortcut': '2.1.4',
845
+ 'click_nonfocusable': '2.1.1',
846
+ 'color_only_link': '1.4.1',
847
+ 'contrast_fail': '1.4.3',
848
+ 'contrast_image_fail': '1.4.3',
849
+ 'contrast_review': '1.4.3',
850
+ 'ctrl_name': '4.1.2',
851
+ 'docx_fake_headings': '1.3.1',
852
+ 'docx_no_alt': '1.1.1',
853
+ 'docx_no_lang': '3.1.1',
854
+ 'docx_table_no_header': '1.3.1',
855
+ 'dom_visual_order': '1.3.2',
856
+ 'down_event': '2.5.2',
857
+ 'drag_no_alt': '2.5.7',
858
+ 'dup_ids': '4.1.2',
859
+ 'element_lang_invalid': '3.1.2',
860
+ 'empty_heading': '1.3.1',
861
+ 'field_label': '3.3.2',
862
+ 'fieldset_missing': '1.3.1',
863
+ 'financial_no_confirm': '3.3.4',
864
+ 'focus_invisible': '2.4.7',
865
+ 'focus_navigates': '3.2.1',
866
+ 'focus_not_focusable': '2.4.7',
867
+ 'focus_obscured': '2.4.11',
868
+ 'forced_colors_svg': '1.4.3',
869
+ 'form_error_missing': '3.3.1',
870
+ 'form_error_no_suggestion': '3.3.3',
871
+ 'form_navigated': '3.3.1',
872
+ 'generic_link': '2.4.4',
873
+ 'gesture_no_click': '2.5.1',
874
+ 'heading_quality': '2.4.6',
875
+ 'heading_skips': '1.3.1',
876
+ 'help_inconsistent': '3.2.6',
877
+ 'hover_not_dismissible': '1.4.13',
878
+ 'iframe_title': '4.1.2',
879
+ 'images_of_text': '1.4.5',
880
+ 'img_no_alt': '1.1.1',
881
+ 'input_img_alt': '1.1.1',
882
+ 'input_navigates': '3.2.2',
883
+ 'journey_dialog_trap': '2.1.2',
884
+ 'journey_duplicate_targets': '4.1.2',
885
+ 'journey_dynamic_stale': '4.1.3',
886
+ 'journey_error_silent': '3.3.1',
887
+ 'journey_focus_lost': '2.4.3',
888
+ 'journey_generic_link': '2.4.4',
889
+ 'journey_heading_nav_broken': '2.4.6',
890
+ 'journey_hidden_in_tree': '1.3.1',
891
+ 'journey_landmark_missing': '2.4.1',
892
+ 'journey_mode_confusion': '4.1.2',
893
+ 'journey_no_instruction': '3.3.2',
894
+ 'journey_reach_fail': '2.1.1',
895
+ 'journey_status_silent': '4.1.3',
896
+ 'journey_timeout_confusion': '2.2.1',
897
+ 'journey_unnamed_control': '4.1.2',
898
+ 'kbd_trap': '2.1.2',
899
+ 'label_in_name': '2.5.3',
900
+ 'label_orphan': '3.3.2',
901
+ 'label_vague': '2.4.6',
902
+ 'landmark_dup': '1.3.1',
903
+ 'lang_invalid': '3.1.1',
904
+ 'lang_missing': '3.1.1',
905
+ 'lang_region_invalid': '3.1.1',
906
+ 'list_structure': '1.3.1',
907
+ 'meta_refresh': '2.2.1',
908
+ 'motion_actuation': '2.5.4',
909
+ 'motion_moving': '2.2.2',
910
+ 'multi_h1': '1.3.1',
911
+ 'multi_label': '3.3.2',
912
+ 'nav_inconsistent': '3.2.3',
913
+ 'no_bypass': '2.4.1',
914
+ 'no_h1': '1.3.1',
915
+ 'no_headings': '1.3.1',
916
+ 'no_multiple_ways': '2.4.5',
917
+ 'no_status_regions': '4.1.3',
918
+ 'orientation_lock': '1.3.4',
919
+ 'pdf_encrypted': '1.1.1',
920
+ 'pdf_fake_link': '2.4.4',
921
+ 'pdf_form_no_label': '3.3.2',
922
+ 'pdf_button_no_name': '4.1.2',
923
+ 'pdf_low_contrast': '1.4.3',
924
+ 'pdf_no_alt': '1.1.1',
925
+ 'pdf_no_lang': '3.1.1',
926
+ 'pdf_no_outline': '1.3.1',
927
+ 'pdf_no_title': '2.4.2',
928
+ 'pdf_scanned': '1.1.1',
929
+ 'pdf_untagged': '1.3.1',
930
+ 'placeholder_only': '3.3.2',
931
+ 'reduced_motion_ignored': '2.2.2',
932
+ 'reflow_fail': '1.4.10',
933
+ 'required_no_indication': '3.3.2',
934
+ 'role_required_attr': '4.1.2',
935
+ 'role_unknown': '4.1.2',
936
+ 'same_name_links': '2.4.4',
937
+ 'scroll_focus': '2.4.3',
938
+ 'scroll_no_announce': '4.1.3',
939
+ 'scroll_no_end': '2.2.2',
940
+ 'scroll_no_feed': '1.3.1',
941
+ 'sensory_text': '1.3.3',
942
+ 'state_contrast': '1.4.3',
943
+ 'tabindex_pos': '2.4.3',
944
+ 'table_no_th': '1.3.1',
945
+ 'text_spacing_clip': '1.4.12',
946
+ 'title_generic': '2.4.2',
947
+ 'title_missing': '2.4.2',
948
+ 'video_autoplay': '1.4.2',
949
+ 'video_captions': '1.2.2',
950
+ 'zoom_max': '1.4.4',
951
+ 'zoom_no': '1.4.4'
952
+ }
953
+
954
+ def criterion(code=None, lang='en', signal=None):
955
+ from .a11yact import act_rules_for
956
+ if signal:
957
+ from .a11yaudit import normalize_signal
958
+ signal = normalize_signal(signal.strip())
959
+ if signal in _SIGNAL_CRIT:
960
+ code = _SIGNAL_CRIT[signal]
961
+ else:
962
+ return {'error': f'señal desconocida: {signal}',
963
+ 'known_signals': len(_SIGNAL_CRIT),
964
+ 'hint': 'signal ids appear in every audit finding'}
965
+ code = code.strip()
966
+ if code not in _C:
967
+ return {'error': f'criterio desconocido: {code}',
968
+ 'available': sorted(_C)}
969
+ level, languages = _C[code]
970
+ name, requires, failures, how_to_check = languages.get(lang) or languages['es']
971
+ out = {
972
+ 'criterion': f'{code} {name}',
973
+ 'level': _LEVEL[level],
974
+ 'understanding': (f'https://www.w3.org/WAI/WCAG22/Understanding/'
975
+ f'{_UNDERSTANDING[code]}.html') if code in _UNDERSTANDING else None,
976
+ 'toolkit_signals': sorted(s for s, c in _SIGNAL_CRIT.items() if c == code),
977
+ }
978
+ if signal:
979
+ out['signal'] = signal
980
+ out['act_rules'] = act_rules_for(signal)
981
+ return out
982
+ out.update({
983
+ 'requires': requires,
984
+ 'typical_failures': failures,
985
+ 'how_to_check': how_to_check,
986
+ 'note': ('Esto resume el criterio, no sustituye su texto oficial en '
987
+ 'https://www.w3.org/TR/WCAG22/#' if lang == 'es' else
988
+ 'This summarizes the criterion; the official text at '
989
+ 'https://www.w3.org/TR/WCAG22/# governs.'),
990
+ })
991
+ return out
992
+
993
+
994
+ def effort(code):
995
+ """Human-effort class for an A/AA criterion: {clase, porque, minutos} or None."""
996
+ if code not in _EFFORT:
997
+ return None
998
+ grade, why = _EFFORT[code]
999
+ return {'class': grade, 'why': why, 'minutes': list(_EFFORT_MINUTES[grade])}
1000
+
1001
+
1002
+ def main(argv):
1003
+ ap = argparse.ArgumentParser(description=__doc__)
1004
+ ap.add_argument('code', nargs='?')
1005
+ ap.add_argument('--signal', help='engine signal id (e.g. kbd_trap) instead of a criterion code')
1006
+ ap.add_argument('--lang', default='en', choices=['en', 'es'])
1007
+ ap.add_argument('--list', action='store_true')
1008
+ a = ap.parse_args(argv)
1009
+ if a.list or not (a.code or a.signal):
1010
+ print(json.dumps({'available_criteria': sorted(_C)}, indent=1))
1011
+ return 0
1012
+ print(json.dumps(criterion(a.code, a.lang, signal=a.signal), ensure_ascii=False, indent=1))
1013
+ return 0
1014
+
1015
+
1016
+ if __name__ == '__main__':
1017
+ sys.exit(main(sys.argv[1:]))