@a11y-checker/screen-reader 0.0.0-stage → 0.2.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.
@@ -0,0 +1,54 @@
1
+ import { NvdaLanguage, NvdaLanguage as NvdaLanguage$1, ScreenReaderAnnouncement, ScreenReaderAnnouncement as ScreenReaderAnnouncement$1 } from "@a11y-checker/core";
2
+ interface AnnounceOptions {
3
+ /** NVDA's language: `'en'` (default) or `'es'`. */
4
+ language?: NvdaLanguage$1;
5
+ }
6
+ /**
7
+ * What NVDA announces for an element in browse mode (with Chrome), in English or, with
8
+ * `{ language: 'es' }`, in Spanish.
9
+ * Returns `null` for document-level elements that are never announced on their own,
10
+ * like `<html>`, `<head>` or `<meta>`.
11
+ *
12
+ * @example
13
+ * announceNvda(document.querySelector('h2')) // { speech: 'heading, level 2, Prices', … }
14
+ * announceNvda(document.querySelector('button.icon')) // { speech: 'button', missingName: true, … }
15
+ * announceNvda(document.querySelector('h2'), { language: 'es' }) // { speech: 'encabezado, nivel 2, Precios', … }
16
+ */
17
+ export declare function announceNvda(element: Element, options?: AnnounceOptions): ScreenReaderAnnouncement$1 | null;
18
+ interface Labels {
19
+ /** Role labels. Landmark roles are composed with `landmark()`. */
20
+ roles: Record<string, string>;
21
+ /** Landmark role names, as composed by `landmark()`. */
22
+ landmarks: Record<string, string>;
23
+ landmark(name: string): string;
24
+ heading(level: number): string;
25
+ list(items: number): string;
26
+ table(rows: number, columns: number): string;
27
+ toggleButton: string;
28
+ menuButton: string;
29
+ states: {
30
+ pressed: string;
31
+ notPressed: string;
32
+ halfPressed: string;
33
+ checked: string;
34
+ notChecked: string;
35
+ halfChecked: string;
36
+ expanded: string;
37
+ collapsed: string;
38
+ /** Switches (checked against real NVDA: "switch, on"). */
39
+ on: string;
40
+ off: string;
41
+ subMenu: string;
42
+ opensDialog: string;
43
+ selected: string;
44
+ multiLine: string;
45
+ unavailable: string;
46
+ readOnly: string;
47
+ required: string;
48
+ invalidEntry: string;
49
+ };
50
+ /** aria-current values. */
51
+ current: Record<string, string>;
52
+ }
53
+ export declare const LABELS: Readonly<Record<NvdaLanguage$1, Labels>>;
54
+ export type { AnnounceOptions, Labels, NvdaLanguage, ScreenReaderAnnouncement };
@@ -0,0 +1,54 @@
1
+ import { NvdaLanguage, NvdaLanguage as NvdaLanguage$1, ScreenReaderAnnouncement, ScreenReaderAnnouncement as ScreenReaderAnnouncement$1 } from "@a11y-checker/core";
2
+ interface AnnounceOptions {
3
+ /** NVDA's language: `'en'` (default) or `'es'`. */
4
+ language?: NvdaLanguage$1;
5
+ }
6
+ /**
7
+ * What NVDA announces for an element in browse mode (with Chrome), in English or, with
8
+ * `{ language: 'es' }`, in Spanish.
9
+ * Returns `null` for document-level elements that are never announced on their own,
10
+ * like `<html>`, `<head>` or `<meta>`.
11
+ *
12
+ * @example
13
+ * announceNvda(document.querySelector('h2')) // { speech: 'heading, level 2, Prices', … }
14
+ * announceNvda(document.querySelector('button.icon')) // { speech: 'button', missingName: true, … }
15
+ * announceNvda(document.querySelector('h2'), { language: 'es' }) // { speech: 'encabezado, nivel 2, Precios', … }
16
+ */
17
+ export declare function announceNvda(element: Element, options?: AnnounceOptions): ScreenReaderAnnouncement$1 | null;
18
+ interface Labels {
19
+ /** Role labels. Landmark roles are composed with `landmark()`. */
20
+ roles: Record<string, string>;
21
+ /** Landmark role names, as composed by `landmark()`. */
22
+ landmarks: Record<string, string>;
23
+ landmark(name: string): string;
24
+ heading(level: number): string;
25
+ list(items: number): string;
26
+ table(rows: number, columns: number): string;
27
+ toggleButton: string;
28
+ menuButton: string;
29
+ states: {
30
+ pressed: string;
31
+ notPressed: string;
32
+ halfPressed: string;
33
+ checked: string;
34
+ notChecked: string;
35
+ halfChecked: string;
36
+ expanded: string;
37
+ collapsed: string;
38
+ /** Switches (checked against real NVDA: "switch, on"). */
39
+ on: string;
40
+ off: string;
41
+ subMenu: string;
42
+ opensDialog: string;
43
+ selected: string;
44
+ multiLine: string;
45
+ unavailable: string;
46
+ readOnly: string;
47
+ required: string;
48
+ invalidEntry: string;
49
+ };
50
+ /** aria-current values. */
51
+ current: Record<string, string>;
52
+ }
53
+ export declare const LABELS: Readonly<Record<NvdaLanguage$1, Labels>>;
54
+ export type { AnnounceOptions, Labels, NvdaLanguage, ScreenReaderAnnouncement };
package/dist/index.js ADDED
@@ -0,0 +1,475 @@
1
+ import { a11y } from "@a11y-checker/engine-native";
2
+ import { computeAccessibleDescription } from "dom-accessibility-api";
3
+ // src/labels.ts
4
+ const plural = (count, one, many) => count === 1 ? one : many;
5
+ const LABELS = {
6
+ en: {
7
+ roles: {
8
+ alert: "",
9
+ alertdialog: "alert dialog",
10
+ application: "application",
11
+ article: "article",
12
+ blockquote: "block quote",
13
+ button: "button",
14
+ checkbox: "check box",
15
+ columnheader: "column header",
16
+ combobox: "combo box",
17
+ definition: "definition",
18
+ dialog: "dialog",
19
+ document: "document",
20
+ feed: "feed",
21
+ figure: "figure",
22
+ grid: "table",
23
+ group: "grouping",
24
+ img: "graphic",
25
+ image: "graphic",
26
+ link: "link",
27
+ listbox: "list",
28
+ log: "log",
29
+ marquee: "marquee",
30
+ math: "math",
31
+ menu: "menu",
32
+ menubar: "menu bar",
33
+ menuitem: "menu item",
34
+ menuitemcheckbox: "check menu item",
35
+ menuitemradio: "radio menu item",
36
+ meter: "meter",
37
+ note: "note",
38
+ option: "option",
39
+ progressbar: "progress bar",
40
+ radio: "radio button",
41
+ radiogroup: "grouping",
42
+ region: "region",
43
+ row: "row",
44
+ rowheader: "row header",
45
+ searchbox: "edit",
46
+ separator: "separator",
47
+ slider: "slider",
48
+ spinbutton: "spin button",
49
+ status: "status bar",
50
+ switch: "switch",
51
+ tab: "tab",
52
+ tablist: "tab control",
53
+ tabpanel: "property page",
54
+ term: "term",
55
+ textbox: "edit",
56
+ timer: "timer",
57
+ toolbar: "tool bar",
58
+ tooltip: "tool tip",
59
+ tree: "tree view",
60
+ treegrid: "tree view",
61
+ treeitem: "tree view item"
62
+ },
63
+ landmarks: {
64
+ banner: "banner",
65
+ complementary: "complementary",
66
+ contentinfo: "content info",
67
+ form: "form",
68
+ main: "main",
69
+ navigation: "navigation",
70
+ search: "search"
71
+ },
72
+ landmark: (name) => `${name} landmark`,
73
+ heading: (level) => `heading, level ${level}`,
74
+ list: (items) => `list with ${items} ${plural(items, "item", "items")}`,
75
+ table: (rows, columns) => `table with ${rows} ${plural(rows, "row", "rows")} and ${columns} ${plural(columns, "column", "columns")}`,
76
+ toggleButton: "toggle button",
77
+ menuButton: "menu button",
78
+ states: {
79
+ pressed: "pressed",
80
+ notPressed: "not pressed",
81
+ halfPressed: "half pressed",
82
+ checked: "checked",
83
+ notChecked: "not checked",
84
+ halfChecked: "half checked",
85
+ expanded: "expanded",
86
+ collapsed: "collapsed",
87
+ on: "on",
88
+ off: "off",
89
+ subMenu: "submenu",
90
+ opensDialog: "opens dialog",
91
+ selected: "selected",
92
+ multiLine: "multi line",
93
+ unavailable: "unavailable",
94
+ readOnly: "read only",
95
+ required: "required",
96
+ invalidEntry: "invalid entry"
97
+ },
98
+ current: {
99
+ page: "current page",
100
+ step: "current step",
101
+ location: "current location",
102
+ date: "current date",
103
+ time: "current time",
104
+ true: "current"
105
+ }
106
+ },
107
+ es: {
108
+ roles: {
109
+ alert: "",
110
+ alertdialog: "diálogo",
111
+ application: "aplicación",
112
+ article: "artículo",
113
+ blockquote: "cita",
114
+ button: "botón",
115
+ checkbox: "casilla de verificación",
116
+ columnheader: "cabecera de columna",
117
+ combobox: "cuadro combinado",
118
+ definition: "definición",
119
+ dialog: "diálogo",
120
+ document: "documento",
121
+ feed: "fuente",
122
+ figure: "figura",
123
+ grid: "tabla",
124
+ group: "agrupación",
125
+ img: "gráfico",
126
+ image: "gráfico",
127
+ link: "enlace",
128
+ listbox: "lista",
129
+ log: "registro",
130
+ marquee: "marquesina",
131
+ math: "matemáticas",
132
+ menu: "menú",
133
+ menubar: "barra de menú",
134
+ menuitem: "elemento de menú",
135
+ menuitemcheckbox: "elemento de menú marcable",
136
+ menuitemradio: "opción de elemento de menú",
137
+ meter: "medidor",
138
+ note: "nota",
139
+ option: "opción",
140
+ progressbar: "barra de progreso",
141
+ radio: "botón de opción",
142
+ radiogroup: "agrupación",
143
+ region: "región",
144
+ row: "fila",
145
+ rowheader: "cabecera de fila",
146
+ searchbox: "edición",
147
+ separator: "separador",
148
+ slider: "deslizador",
149
+ spinbutton: "botón Giratorio",
150
+ status: "barra de estado",
151
+ switch: "conmutador",
152
+ tab: "pestaña",
153
+ tablist: "lista de pestañas",
154
+ tabpanel: "página de propiedades",
155
+ term: "term",
156
+ textbox: "edición",
157
+ timer: "temporizador",
158
+ toolbar: "barra de herramientas",
159
+ tooltip: "consejo",
160
+ tree: "árbol",
161
+ treegrid: "árbol",
162
+ treeitem: "elemento de árbol"
163
+ },
164
+ landmarks: {
165
+ banner: "título",
166
+ complementary: "complementario",
167
+ contentinfo: "información de contenido",
168
+ form: "formulario",
169
+ main: "principal",
170
+ navigation: "navegación",
171
+ search: "búsqueda"
172
+ },
173
+ landmark: (name) => `${name} región`,
174
+ heading: (level) => `encabezado, nivel ${level}`,
175
+ list: (items) => `lista con ${items} ${plural(items, "elemento", "elementos")}`,
176
+ table: (rows, columns) => `tabla con ${rows} ${plural(rows, "fila", "filas")} y ${columns} ${plural(columns, "columna", "columnas")}`,
177
+ toggleButton: "botón conmutador",
178
+ menuButton: "botón de menú",
179
+ states: {
180
+ pressed: "pulsado",
181
+ notPressed: "sin pulsar",
182
+ halfPressed: "semi pulsado",
183
+ checked: "marcado",
184
+ notChecked: "sin marcar",
185
+ halfChecked: "semimarcado",
186
+ expanded: "expandido",
187
+ collapsed: "contraído",
188
+ on: "activado",
189
+ off: "desactivado",
190
+ subMenu: "submenú",
191
+ opensDialog: "abre diálogo",
192
+ selected: "seleccionado",
193
+ multiLine: "multilínea",
194
+ unavailable: "no disponible",
195
+ readOnly: "sólo lectura",
196
+ required: "requerido",
197
+ invalidEntry: "entrada inválida"
198
+ },
199
+ current: {
200
+ page: "página actual",
201
+ step: "paso actual",
202
+ location: "ubicación actual",
203
+ date: "fecha actual",
204
+ time: "hora actual",
205
+ true: "actual"
206
+ }
207
+ }
208
+ };
209
+ // src/nvda.ts
210
+ /**
211
+ * Roles NVDA announces as "<name> <role>" rather than "<role> <name>". Checked against
212
+ * real NVDA: landmarks ("Main menu, navigation landmark") and progress bars ("Upload,
213
+ * progress bar, 40"), but not dialogs ("dialog, Settings").
214
+ */
215
+ const NAME_FIRST = /* @__PURE__ */ new Set([
216
+ .../* @__PURE__ */ new Set([
217
+ "banner",
218
+ "complementary",
219
+ "contentinfo",
220
+ "form",
221
+ "main",
222
+ "navigation",
223
+ "region",
224
+ "search"
225
+ ]),
226
+ "group",
227
+ "radiogroup",
228
+ "progressbar"
229
+ ]);
230
+ /** Roles that need an accessible name to be usable (WAI-ARIA "name required"). */
231
+ const NAME_REQUIRED = /* @__PURE__ */ new Set([
232
+ "alertdialog",
233
+ "button",
234
+ "checkbox",
235
+ "columnheader",
236
+ "combobox",
237
+ "dialog",
238
+ "heading",
239
+ "img",
240
+ "image",
241
+ "link",
242
+ "listbox",
243
+ "menuitem",
244
+ "menuitemcheckbox",
245
+ "menuitemradio",
246
+ "meter",
247
+ "option",
248
+ "progressbar",
249
+ "radio",
250
+ "radiogroup",
251
+ "rowheader",
252
+ "searchbox",
253
+ "slider",
254
+ "spinbutton",
255
+ "switch",
256
+ "tab",
257
+ "textbox",
258
+ "tree",
259
+ "treeitem"
260
+ ]);
261
+ /** Elements that are never announced on their own. */
262
+ const NOT_ANNOUNCED = /* @__PURE__ */ new Set([
263
+ "html",
264
+ "head",
265
+ "body",
266
+ "title",
267
+ "meta",
268
+ "link",
269
+ "style",
270
+ "script",
271
+ "base",
272
+ "noscript",
273
+ "template"
274
+ ]);
275
+ const normalize = (text) => text.replace(/\s+/g, " ").trim();
276
+ const truncate = (text, max = 150) => text.length > max ? `${text.slice(0, max - 1)}…` : text;
277
+ const aria = (element, name) => element.getAttribute(`aria-${name}`)?.trim();
278
+ function headingLevel(element) {
279
+ const level = Number(aria(element, "level"));
280
+ if (Number.isInteger(level) && level > 0) return level;
281
+ const match = /^h([1-6])$/.exec(element.localName);
282
+ return match ? Number(match[1]) : 2;
283
+ }
284
+ /** Elements in the accessibility tree whose closest owning ancestor is `container`. */
285
+ function ownedCount(container, role, within) {
286
+ let count = 0;
287
+ for (const element of container.querySelectorAll("*")) {
288
+ if (a11y.semanticRole(element) !== role || a11y.isProgrammaticallyHidden(element)) continue;
289
+ let owner = element.parentElement;
290
+ while (owner && owner !== container && a11y.semanticRole(owner) !== within) owner = owner.parentElement;
291
+ if (owner === container) count++;
292
+ }
293
+ return count;
294
+ }
295
+ function tableSize(table) {
296
+ if (table.localName === "table") {
297
+ const rows = Array.from(table.rows);
298
+ const columns = Math.max(0, ...rows.map((row) => Array.from(row.cells).reduce((sum, cell) => sum + cell.colSpan, 0)));
299
+ return {
300
+ rows: rows.length,
301
+ columns
302
+ };
303
+ }
304
+ const rows = Array.from(table.querySelectorAll("[role=\"row\"]"));
305
+ const columns = Math.max(0, ...rows.map((row) => row.querySelectorAll("[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"]").length));
306
+ return {
307
+ rows: rows.length,
308
+ columns
309
+ };
310
+ }
311
+ function isChecked(element) {
312
+ if (element.localName === "input") {
313
+ const input = element;
314
+ if (input.type === "checkbox" || input.type === "radio") {
315
+ if (input.indeterminate) return "mixed";
316
+ return input.checked ? "true" : "false";
317
+ }
318
+ }
319
+ const value = aria(element, "checked");
320
+ if (value === "true" || value === "mixed") return value;
321
+ return "false";
322
+ }
323
+ function isExpanded(element) {
324
+ if (element.localName === "summary" && element.parentElement?.localName === "details") return element.parentElement.open;
325
+ const value = aria(element, "expanded");
326
+ if (value === "true") return true;
327
+ if (value === "false") return false;
328
+ return null;
329
+ }
330
+ function states(element, role, labels) {
331
+ const result = [];
332
+ const state = labels.states;
333
+ const isTextField = role === "textbox" || role === "searchbox" || role === "combobox";
334
+ if (role === "button" && aria(element, "pressed")) {
335
+ const pressed = aria(element, "pressed");
336
+ result.push(pressed === "true" ? state.pressed : pressed === "mixed" ? state.halfPressed : state.notPressed);
337
+ }
338
+ if ([
339
+ "checkbox",
340
+ "radio",
341
+ "menuitemcheckbox",
342
+ "menuitemradio",
343
+ "switch"
344
+ ].includes(role)) {
345
+ const checked = isChecked(element);
346
+ if (role === "switch") result.push(checked === "true" ? state.on : state.off);
347
+ else if (checked === "mixed") result.push(state.halfChecked);
348
+ else if (checked === "true") result.push(state.checked);
349
+ else if (role === "checkbox" || role === "radio") result.push(state.notChecked);
350
+ }
351
+ const expanded = isExpanded(element);
352
+ if (expanded !== null) result.push(expanded ? state.expanded : state.collapsed);
353
+ const popup = aria(element, "haspopup");
354
+ if (popup === "true" || popup === "menu") result.push(state.subMenu);
355
+ else if (popup === "dialog") result.push(state.opensDialog);
356
+ if (aria(element, "selected") === "true") result.push(state.selected);
357
+ const current = aria(element, "current");
358
+ if (current && current !== "false") result.push(labels.current[current] ?? labels.current.true ?? "");
359
+ if (isTextField && element.localName === "textarea" || aria(element, "multiline") === "true") result.push(state.multiLine);
360
+ if (element.matches(":disabled") || aria(element, "disabled") === "true") result.push(state.unavailable);
361
+ if (element.hasAttribute("readonly") || aria(element, "readonly") === "true") {
362
+ if (isTextField || role === "spinbutton" || role === "grid") result.push(state.readOnly);
363
+ }
364
+ if (element.hasAttribute("required") || aria(element, "required") === "true") result.push(state.required);
365
+ const invalid = aria(element, "invalid");
366
+ if (invalid && invalid !== "false") result.push(state.invalidEntry);
367
+ return result;
368
+ }
369
+ function value(element, role) {
370
+ if (role === "textbox" || role === "searchbox" || role === "spinbutton") {
371
+ if (element.localName === "input" || element.localName === "textarea") return element.value;
372
+ }
373
+ if (role === "combobox" && element.localName === "select") return normalize(element.selectedOptions[0]?.textContent ?? "");
374
+ if ([
375
+ "slider",
376
+ "progressbar",
377
+ "meter",
378
+ "spinbutton",
379
+ "scrollbar"
380
+ ].includes(role)) {
381
+ const ariaValue = aria(element, "valuetext") || aria(element, "valuenow");
382
+ if (ariaValue) return ariaValue;
383
+ if (element.localName === "input") return element.value;
384
+ return "";
385
+ }
386
+ return "";
387
+ }
388
+ function roleLabel(element, role, name, labels) {
389
+ if (role === "region" && !name) return "";
390
+ if (role === "form" && !name) return "";
391
+ if (role === "button" && aria(element, "pressed")) return labels.toggleButton;
392
+ const popup = aria(element, "haspopup");
393
+ if (role === "button" && (popup === "true" || popup === "menu")) return labels.menuButton;
394
+ if (role === "heading") return labels.heading(headingLevel(element));
395
+ if (role === "list") return labels.list(ownedCount(element, "listitem", "list"));
396
+ if (role === "listbox") return labels.list(ownedCount(element, "option", "listbox"));
397
+ if (role === "table" || role === "grid" || role === "treegrid") {
398
+ const { rows, columns } = tableSize(element);
399
+ return labels.table(rows, columns);
400
+ }
401
+ const landmark = labels.landmarks[role];
402
+ if (landmark) return labels.landmark(landmark);
403
+ return labels.roles[role] ?? "";
404
+ }
405
+ const silent = (language, role, name = "") => ({
406
+ reader: "nvda",
407
+ language,
408
+ role,
409
+ name,
410
+ speech: "",
411
+ silent: true,
412
+ missingName: false
413
+ });
414
+ /**
415
+ * What NVDA announces for an element in browse mode (with Chrome), in English or, with
416
+ * `{ language: 'es' }`, in Spanish.
417
+ * Returns `null` for document-level elements that are never announced on their own,
418
+ * like `<html>`, `<head>` or `<meta>`.
419
+ *
420
+ * @example
421
+ * announceNvda(document.querySelector('h2')) // { speech: 'heading, level 2, Prices', … }
422
+ * announceNvda(document.querySelector('button.icon')) // { speech: 'button', missingName: true, … }
423
+ * announceNvda(document.querySelector('h2'), { language: 'es' }) // { speech: 'encabezado, nivel 2, Precios', … }
424
+ */
425
+ function announceNvda(element, options = {}) {
426
+ const language = options.language ?? "en";
427
+ const labels = LABELS[language];
428
+ if (NOT_ANNOUNCED.has(element.localName)) return null;
429
+ if (a11y.isProgrammaticallyHidden(element)) return silent(language, a11y.semanticRole(element));
430
+ const role = a11y.semanticRole(element);
431
+ const name = a11y.accessibleName(element);
432
+ const textOnly = () => {
433
+ const text = truncate(normalize(element.textContent));
434
+ return text ? {
435
+ reader: "nvda",
436
+ language,
437
+ role,
438
+ name,
439
+ speech: text,
440
+ silent: false,
441
+ missingName: false
442
+ } : silent(language, role, name);
443
+ };
444
+ if (!role || role === "none" || role === "presentation" || role === "generic") return textOnly();
445
+ if ((role === "img" || role === "image") && !name) return {
446
+ ...silent(language, role),
447
+ missingName: true
448
+ };
449
+ const label = roleLabel(element, role, name, labels);
450
+ if (!label && !name && !NAME_REQUIRED.has(role)) return textOnly();
451
+ const parts = [];
452
+ const nameFirst = NAME_FIRST.has(role);
453
+ if (nameFirst && name) parts.push(name);
454
+ if (label) parts.push(label);
455
+ parts.push(...states(element, role, labels));
456
+ if (!nameFirst && name) parts.push(truncate(name));
457
+ const current = value(element, role);
458
+ if (current && current !== name) parts.push(truncate(current));
459
+ const description = normalize(computeAccessibleDescription(element));
460
+ if (description && description !== name) parts.push(truncate(description));
461
+ const speech = parts.join(", ");
462
+ const missingName = NAME_REQUIRED.has(role) && !name;
463
+ return {
464
+ reader: "nvda",
465
+ language,
466
+ role,
467
+ name,
468
+ speech,
469
+ silent: speech === "",
470
+ missingName
471
+ };
472
+ }
473
+ export { LABELS, announceNvda };
474
+
475
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["select"],"sources":["../src/labels.ts","../src/nvda.ts"],"sourcesContent":["// NVDA's wording, per language. The English labels are NVDA's own; the Spanish ones\n// come from NVDA's official Spanish translation (source/locale/es/LC_MESSAGES/nvda.po\n// in nvaccess/nvda), except where marked \"not in the catalog\".\nimport type { NvdaLanguage } from '@a11y-checker/core';\n\nexport interface Labels {\n /** Role labels. Landmark roles are composed with `landmark()`. */\n roles: Record<string, string>;\n /** Landmark role names, as composed by `landmark()`. */\n landmarks: Record<string, string>;\n landmark(name: string): string;\n heading(level: number): string;\n list(items: number): string;\n table(rows: number, columns: number): string;\n toggleButton: string;\n menuButton: string;\n states: {\n pressed: string;\n notPressed: string;\n halfPressed: string;\n checked: string;\n notChecked: string;\n halfChecked: string;\n expanded: string;\n collapsed: string;\n /** Switches (checked against real NVDA: \"switch, on\"). */\n on: string;\n off: string;\n subMenu: string;\n opensDialog: string;\n selected: string;\n multiLine: string;\n unavailable: string;\n readOnly: string;\n required: string;\n invalidEntry: string;\n };\n /** aria-current values. */\n current: Record<string, string>;\n}\n\nconst plural = (count: number, one: string, many: string) => (count === 1 ? one : many);\n\nconst EN: Labels = {\n roles: {\n // Browse mode reads an alert's text without its role (checked against real NVDA).\n alert: '',\n alertdialog: 'alert dialog',\n application: 'application',\n article: 'article',\n blockquote: 'block quote',\n button: 'button',\n checkbox: 'check box',\n columnheader: 'column header',\n combobox: 'combo box',\n definition: 'definition',\n dialog: 'dialog',\n document: 'document',\n feed: 'feed',\n figure: 'figure',\n grid: 'table',\n group: 'grouping',\n img: 'graphic',\n image: 'graphic',\n link: 'link',\n listbox: 'list',\n log: 'log',\n marquee: 'marquee',\n math: 'math',\n menu: 'menu',\n menubar: 'menu bar',\n menuitem: 'menu item',\n menuitemcheckbox: 'check menu item',\n menuitemradio: 'radio menu item',\n meter: 'meter',\n note: 'note',\n option: 'option',\n progressbar: 'progress bar',\n radio: 'radio button',\n radiogroup: 'grouping',\n region: 'region',\n row: 'row',\n rowheader: 'row header',\n searchbox: 'edit',\n separator: 'separator',\n slider: 'slider',\n spinbutton: 'spin button',\n status: 'status bar',\n switch: 'switch',\n tab: 'tab',\n tablist: 'tab control',\n tabpanel: 'property page',\n term: 'term',\n textbox: 'edit',\n timer: 'timer',\n toolbar: 'tool bar',\n tooltip: 'tool tip',\n tree: 'tree view',\n treegrid: 'tree view',\n treeitem: 'tree view item',\n },\n landmarks: {\n banner: 'banner',\n complementary: 'complementary',\n contentinfo: 'content info',\n form: 'form',\n main: 'main',\n navigation: 'navigation',\n search: 'search',\n },\n landmark: (name) => `${name} landmark`,\n heading: (level) => `heading, level ${level}`,\n list: (items) => `list with ${items} ${plural(items, 'item', 'items')}`,\n table: (rows, columns) =>\n `table with ${rows} ${plural(rows, 'row', 'rows')} and ${columns} ${plural(columns, 'column', 'columns')}`,\n toggleButton: 'toggle button',\n menuButton: 'menu button',\n states: {\n pressed: 'pressed',\n notPressed: 'not pressed',\n halfPressed: 'half pressed',\n checked: 'checked',\n notChecked: 'not checked',\n halfChecked: 'half checked',\n expanded: 'expanded',\n collapsed: 'collapsed',\n on: 'on',\n off: 'off',\n subMenu: 'submenu',\n opensDialog: 'opens dialog',\n selected: 'selected',\n multiLine: 'multi line',\n unavailable: 'unavailable',\n readOnly: 'read only',\n required: 'required',\n invalidEntry: 'invalid entry',\n },\n current: {\n page: 'current page',\n step: 'current step',\n location: 'current location',\n date: 'current date',\n time: 'current time',\n true: 'current',\n },\n};\n\nconst ES: Labels = {\n roles: {\n alert: '',\n alertdialog: 'diálogo', // Not in the catalog: NVDA reports alert dialogs as dialogs.\n application: 'aplicación',\n article: 'artículo',\n blockquote: 'cita',\n button: 'botón',\n checkbox: 'casilla de verificación',\n columnheader: 'cabecera de columna',\n combobox: 'cuadro combinado',\n definition: 'definición',\n dialog: 'diálogo',\n document: 'documento',\n feed: 'fuente', // Not in the catalog.\n figure: 'figura',\n grid: 'tabla',\n group: 'agrupación',\n img: 'gráfico',\n image: 'gráfico',\n link: 'enlace',\n listbox: 'lista',\n log: 'registro',\n marquee: 'marquesina', // Not in the catalog.\n math: 'matemáticas',\n menu: 'menú',\n menubar: 'barra de menú',\n menuitem: 'elemento de menú',\n menuitemcheckbox: 'elemento de menú marcable',\n menuitemradio: 'opción de elemento de menú',\n meter: 'medidor', // Not in the catalog.\n note: 'nota',\n option: 'opción', // Not in the catalog.\n progressbar: 'barra de progreso',\n radio: 'botón de opción',\n radiogroup: 'agrupación',\n region: 'región',\n row: 'fila',\n rowheader: 'cabecera de fila',\n searchbox: 'edición',\n separator: 'separador',\n slider: 'deslizador',\n spinbutton: 'botón Giratorio',\n status: 'barra de estado',\n switch: 'conmutador',\n tab: 'pestaña',\n tablist: 'lista de pestañas',\n tabpanel: 'página de propiedades',\n term: 'term',\n textbox: 'edición',\n timer: 'temporizador', // Not in the catalog.\n toolbar: 'barra de herramientas',\n tooltip: 'consejo',\n tree: 'árbol',\n treegrid: 'árbol',\n treeitem: 'elemento de árbol',\n },\n landmarks: {\n banner: 'título',\n complementary: 'complementario',\n contentinfo: 'información de contenido',\n form: 'formulario',\n main: 'principal',\n navigation: 'navegación',\n search: 'búsqueda',\n },\n // NVDA says the landmark name followed by its word for \"landmark\" (\"región\").\n landmark: (name) => `${name} región`,\n heading: (level) => `encabezado, nivel ${level}`,\n list: (items) => `lista con ${items} ${plural(items, 'elemento', 'elementos')}`,\n table: (rows, columns) =>\n `tabla con ${rows} ${plural(rows, 'fila', 'filas')} y ${columns} ${plural(columns, 'columna', 'columnas')}`,\n toggleButton: 'botón conmutador',\n menuButton: 'botón de menú',\n states: {\n pressed: 'pulsado',\n notPressed: 'sin pulsar',\n halfPressed: 'semi pulsado',\n checked: 'marcado',\n notChecked: 'sin marcar',\n halfChecked: 'semimarcado',\n expanded: 'expandido',\n collapsed: 'contraído',\n on: 'activado',\n off: 'desactivado',\n subMenu: 'submenú',\n opensDialog: 'abre diálogo',\n selected: 'seleccionado',\n multiLine: 'multilínea',\n unavailable: 'no disponible',\n readOnly: 'sólo lectura',\n required: 'requerido',\n invalidEntry: 'entrada inválida',\n },\n current: {\n page: 'página actual',\n step: 'paso actual',\n location: 'ubicación actual',\n date: 'fecha actual',\n time: 'hora actual',\n true: 'actual',\n },\n};\n\nexport const LABELS: Readonly<Record<NvdaLanguage, Labels>> = { en: EN, es: ES };\n","// A model of what NVDA says for an element in browse mode, with Chrome, at default\n// verbosity, in English or Spanish. It is computed from the accessibility tree (role,\n// name, states and description), so it shows what NVDA *can* say: if the role or name\n// is missing here, it is missing for NVDA too. Wording follows NVDA's role and state\n// labels (labels.ts); exact phrasing, punctuation and order can differ between NVDA\n// versions.\nimport type { NvdaLanguage, ScreenReaderAnnouncement } from '@a11y-checker/core';\nimport { a11y } from '@a11y-checker/engine-native';\nimport { computeAccessibleDescription } from 'dom-accessibility-api';\nimport { LABELS, type Labels } from './labels.js';\n\nconst LANDMARKS = new Set([\n 'banner',\n 'complementary',\n 'contentinfo',\n 'form',\n 'main',\n 'navigation',\n 'region',\n 'search',\n]);\n\n/**\n * Roles NVDA announces as \"<name> <role>\" rather than \"<role> <name>\". Checked against\n * real NVDA: landmarks (\"Main menu, navigation landmark\") and progress bars (\"Upload,\n * progress bar, 40\"), but not dialogs (\"dialog, Settings\").\n */\nconst NAME_FIRST = new Set([...LANDMARKS, 'group', 'radiogroup', 'progressbar']);\n\n/** Roles that need an accessible name to be usable (WAI-ARIA \"name required\"). */\nconst NAME_REQUIRED = new Set([\n 'alertdialog',\n 'button',\n 'checkbox',\n 'columnheader',\n 'combobox',\n 'dialog',\n 'heading',\n 'img',\n 'image',\n 'link',\n 'listbox',\n 'menuitem',\n 'menuitemcheckbox',\n 'menuitemradio',\n 'meter',\n 'option',\n 'progressbar',\n 'radio',\n 'radiogroup',\n 'rowheader',\n 'searchbox',\n 'slider',\n 'spinbutton',\n 'switch',\n 'tab',\n 'textbox',\n 'tree',\n 'treeitem',\n]);\n\n/** Elements that are never announced on their own. */\nconst NOT_ANNOUNCED = new Set([\n 'html',\n 'head',\n 'body',\n 'title',\n 'meta',\n 'link',\n 'style',\n 'script',\n 'base',\n 'noscript',\n 'template',\n]);\n\nconst normalize = (text: string) => text.replace(/\\s+/g, ' ').trim();\nconst truncate = (text: string, max = 150) =>\n text.length > max ? `${text.slice(0, max - 1)}…` : text;\n\nconst aria = (element: Element, name: string) => element.getAttribute(`aria-${name}`)?.trim();\n\nfunction headingLevel(element: Element): number {\n const level = Number(aria(element, 'level'));\n if (Number.isInteger(level) && level > 0) return level;\n const match = /^h([1-6])$/.exec(element.localName);\n return match ? Number(match[1]) : 2;\n}\n\n/** Elements in the accessibility tree whose closest owning ancestor is `container`. */\nfunction ownedCount(container: Element, role: string, within: string): number {\n let count = 0;\n for (const element of container.querySelectorAll('*')) {\n if (a11y.semanticRole(element) !== role || a11y.isProgrammaticallyHidden(element)) continue;\n let owner = element.parentElement;\n while (owner && owner !== container && a11y.semanticRole(owner) !== within) {\n owner = owner.parentElement;\n }\n if (owner === container) count++;\n }\n return count;\n}\n\nfunction tableSize(table: Element): { rows: number; columns: number } {\n if (table.localName === 'table') {\n const rows = Array.from((table as HTMLTableElement).rows);\n const columns = Math.max(\n 0,\n ...rows.map((row) => Array.from(row.cells).reduce((sum, cell) => sum + cell.colSpan, 0)),\n );\n return { rows: rows.length, columns };\n }\n const rows = Array.from(table.querySelectorAll('[role=\"row\"]'));\n const columns = Math.max(\n 0,\n ...rows.map(\n (row) =>\n row.querySelectorAll(\n '[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"]',\n ).length,\n ),\n );\n return { rows: rows.length, columns };\n}\n\nfunction isChecked(element: Element): 'true' | 'false' | 'mixed' | null {\n if (element.localName === 'input') {\n const input = element as HTMLInputElement;\n if (input.type === 'checkbox' || input.type === 'radio') {\n if (input.indeterminate) return 'mixed';\n return input.checked ? 'true' : 'false';\n }\n }\n const value = aria(element, 'checked');\n if (value === 'true' || value === 'mixed') return value;\n return 'false';\n}\n\nfunction isExpanded(element: Element): boolean | null {\n if (element.localName === 'summary' && element.parentElement?.localName === 'details') {\n return (element.parentElement as HTMLDetailsElement).open;\n }\n const value = aria(element, 'expanded');\n if (value === 'true') return true;\n if (value === 'false') return false;\n return null;\n}\n\nfunction states(element: Element, role: string, labels: Labels): string[] {\n const result: string[] = [];\n const state = labels.states;\n const isTextField = role === 'textbox' || role === 'searchbox' || role === 'combobox';\n\n if (role === 'button' && aria(element, 'pressed')) {\n const pressed = aria(element, 'pressed');\n result.push(\n pressed === 'true'\n ? state.pressed\n : pressed === 'mixed'\n ? state.halfPressed\n : state.notPressed,\n );\n }\n if (['checkbox', 'radio', 'menuitemcheckbox', 'menuitemradio', 'switch'].includes(role)) {\n const checked = isChecked(element);\n // Checked against real NVDA: \"switch, on\" / \"conmutador, activado\".\n if (role === 'switch') result.push(checked === 'true' ? state.on : state.off);\n else if (checked === 'mixed') result.push(state.halfChecked);\n else if (checked === 'true') result.push(state.checked);\n else if (role === 'checkbox' || role === 'radio') result.push(state.notChecked);\n }\n const expanded = isExpanded(element);\n if (expanded !== null) result.push(expanded ? state.expanded : state.collapsed);\n const popup = aria(element, 'haspopup');\n if (popup === 'true' || popup === 'menu') result.push(state.subMenu);\n else if (popup === 'dialog') result.push(state.opensDialog);\n if (aria(element, 'selected') === 'true') result.push(state.selected);\n const current = aria(element, 'current');\n if (current && current !== 'false') {\n result.push(labels.current[current] ?? labels.current.true ?? '');\n }\n if ((isTextField && element.localName === 'textarea') || aria(element, 'multiline') === 'true') {\n result.push(state.multiLine);\n }\n if (element.matches(':disabled') || aria(element, 'disabled') === 'true') {\n result.push(state.unavailable);\n }\n if (element.hasAttribute('readonly') || aria(element, 'readonly') === 'true') {\n if (isTextField || role === 'spinbutton' || role === 'grid') result.push(state.readOnly);\n }\n if (element.hasAttribute('required') || aria(element, 'required') === 'true') {\n result.push(state.required);\n }\n const invalid = aria(element, 'invalid');\n if (invalid && invalid !== 'false') result.push(state.invalidEntry);\n return result;\n}\n\nfunction value(element: Element, role: string): string {\n if (role === 'textbox' || role === 'searchbox' || role === 'spinbutton') {\n if (element.localName === 'input' || element.localName === 'textarea') {\n // In browse mode NVDA says nothing for an empty field (\"blank\" is focus mode).\n return (element as HTMLInputElement).value;\n }\n }\n if (role === 'combobox' && element.localName === 'select') {\n const select = element as HTMLSelectElement;\n return normalize(select.selectedOptions[0]?.textContent ?? '');\n }\n if (['slider', 'progressbar', 'meter', 'spinbutton', 'scrollbar'].includes(role)) {\n const ariaValue = aria(element, 'valuetext') || aria(element, 'valuenow');\n if (ariaValue) return ariaValue;\n // A native range input: NVDA reads its value (\"Volume, slider, 30\").\n if (element.localName === 'input') return (element as HTMLInputElement).value;\n return '';\n }\n return '';\n}\n\nfunction roleLabel(element: Element, role: string, name: string, labels: Labels): string {\n if (role === 'region' && !name) return ''; // An unnamed region is not a landmark.\n if (role === 'form' && !name) return '';\n if (role === 'button' && aria(element, 'pressed')) return labels.toggleButton;\n // Checked against real NVDA 2025 with Chrome (nvda/ workflow).\n const popup = aria(element, 'haspopup');\n if (role === 'button' && (popup === 'true' || popup === 'menu')) return labels.menuButton;\n if (role === 'heading') return labels.heading(headingLevel(element));\n if (role === 'list') return labels.list(ownedCount(element, 'listitem', 'list'));\n if (role === 'listbox') return labels.list(ownedCount(element, 'option', 'listbox'));\n if (role === 'table' || role === 'grid' || role === 'treegrid') {\n const { rows, columns } = tableSize(element);\n return labels.table(rows, columns);\n }\n const landmark = labels.landmarks[role];\n if (landmark) return labels.landmark(landmark);\n return labels.roles[role] ?? '';\n}\n\nexport interface AnnounceOptions {\n /** NVDA's language: `'en'` (default) or `'es'`. */\n language?: NvdaLanguage;\n}\n\nconst silent = (\n language: NvdaLanguage,\n role: string | null,\n name = '',\n): ScreenReaderAnnouncement => ({\n reader: 'nvda',\n language,\n role,\n name,\n speech: '',\n silent: true,\n missingName: false,\n});\n\n/**\n * What NVDA announces for an element in browse mode (with Chrome), in English or, with\n * `{ language: 'es' }`, in Spanish.\n * Returns `null` for document-level elements that are never announced on their own,\n * like `<html>`, `<head>` or `<meta>`.\n *\n * @example\n * announceNvda(document.querySelector('h2')) // { speech: 'heading, level 2, Prices', … }\n * announceNvda(document.querySelector('button.icon')) // { speech: 'button', missingName: true, … }\n * announceNvda(document.querySelector('h2'), { language: 'es' }) // { speech: 'encabezado, nivel 2, Precios', … }\n */\nexport function announceNvda(\n element: Element,\n options: AnnounceOptions = {},\n): ScreenReaderAnnouncement | null {\n const language = options.language ?? 'en';\n const labels = LABELS[language];\n if (NOT_ANNOUNCED.has(element.localName)) return null;\n if (a11y.isProgrammaticallyHidden(element)) {\n return silent(language, a11y.semanticRole(element));\n }\n\n const role = a11y.semanticRole(element);\n const name = a11y.accessibleName(element);\n // NVDA reads the text of elements it has no role label for, and skips them when empty.\n const textOnly = () => {\n const text = truncate(normalize(element.textContent));\n return text\n ? {\n reader: 'nvda' as const,\n language,\n role,\n name,\n speech: text,\n silent: false,\n missingName: false,\n }\n : silent(language, role, name);\n };\n if (!role || role === 'none' || role === 'presentation' || role === 'generic') return textOnly();\n\n // NVDA skips images without a name in browse mode (checked against real NVDA: it\n // says nothing for <img> without alt).\n if ((role === 'img' || role === 'image') && !name) {\n return { ...silent(language, role), missingName: true };\n }\n\n const label = roleLabel(element, role, name, labels);\n if (!label && !name && !NAME_REQUIRED.has(role)) return textOnly();\n const parts: string[] = [];\n const nameFirst = NAME_FIRST.has(role);\n if (nameFirst && name) parts.push(name);\n if (label) parts.push(label);\n parts.push(...states(element, role, labels));\n if (!nameFirst && name) parts.push(truncate(name));\n const current = value(element, role);\n if (current && current !== name) parts.push(truncate(current));\n const description = normalize(computeAccessibleDescription(element));\n if (description && description !== name) parts.push(truncate(description));\n\n const speech = parts.join(', ');\n const missingName = NAME_REQUIRED.has(role) && !name;\n return { reader: 'nvda', language, role, name, speech, silent: speech === '', missingName };\n}\n"],"mappings":";;;AAyCA,MAAM,UAAU,OAAe,KAAa,SAAkB,UAAU,IAAI,MAAM;AAkNlF,MAAa,SAAiD;CAAE,IAAI;EA/MlE,OAAO;GAEL,OAAO;GACP,aAAa;GACb,aAAa;GACb,SAAS;GACT,YAAY;GACZ,QAAQ;GACR,UAAU;GACV,cAAc;GACd,UAAU;GACV,YAAY;GACZ,QAAQ;GACR,UAAU;GACV,MAAM;GACN,QAAQ;GACR,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACP,MAAM;GACN,SAAS;GACT,KAAK;GACL,SAAS;GACT,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,kBAAkB;GAClB,eAAe;GACf,OAAO;GACP,MAAM;GACN,QAAQ;GACR,aAAa;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