@a11y-checker/screen-reader 0.0.0-stage → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jesús Germade
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # @a11y-checker/screen-reader
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ What a screen reader announces for an element. It models **NVDA in browse mode, with
4
+ Chrome, in English, at default verbosity**, from the accessibility tree: role, name,
5
+ states, value and description.
6
+
7
+ It powers the `nvda` profile of a11y-checker (`check({ profile: 'nvda' })`), which adds
8
+ the announcement to every failing node of a report.
9
+
10
+ ```ts
11
+ import { announceNvda } from '@a11y-checker/screen-reader';
12
+
13
+ announceNvda(document.querySelector('h2'));
14
+ // { reader: 'nvda', role: 'heading', name: 'Prices',
15
+ // speech: 'heading, level 2, Prices', silent: false, missingName: false }
16
+
17
+ announceNvda(document.querySelector('button.icon-only'));
18
+ // { …, speech: 'button', missingName: true } → NVDA says only "button"
19
+
20
+ announceNvda(document.querySelector('img[alt=""]'));
21
+ // { …, speech: '', silent: true } → NVDA skips it
22
+ ```
23
+
24
+ Examples of the speech it produces:
25
+
26
+ | HTML | Speech |
27
+ | ------------------------------------------------------- | -------------------------------------- |
28
+ | `<a href="/">Home</a>` | `link, Home` |
29
+ | `<button aria-pressed="true">Bold</button>` | `toggle button, pressed, Bold` |
30
+ | `<input type="checkbox"> I agree` (in a label) | `check box, not checked, I agree` |
31
+ | `<input required aria-invalid="true">` labelled "Email" | `edit, required, invalid entry, Email` |
32
+ | `<nav aria-label="Main menu">` | `Main menu, navigation landmark` |
33
+ | `<ul>` with 2 visible items | `list with 2 items` |
34
+
35
+ ## Spanish
36
+
37
+ `announceNvda(element, { language: 'es' })` uses NVDA's Spanish wording, taken from
38
+ NVDA's official Spanish translation (`source/locale/es/LC_MESSAGES/nvda.po` in
39
+ [nvaccess/nvda](https://github.com/nvaccess/nvda)). In a check, pass
40
+ `nvdaLanguage: 'es'` (CLI: `--nvda-language es`).
41
+
42
+ | HTML | English | Spanish |
43
+ | ----------------------------------------------- | --------------------------------------- | ---------------------------------------------- |
44
+ | `<a href="/">Inicio</a>` | `link, Inicio` | `enlace, Inicio` |
45
+ | `<button>` with only an icon | `button` | `botón` |
46
+ | `<h2>Precios</h2>` | `heading, level 2, Precios` | `encabezado, nivel 2, Precios` |
47
+ | `<input type="checkbox">` labelled "Acepto" | `check box, not checked, Acepto` | `casilla de verificación, sin marcar, Acepto` |
48
+ | `<input required aria-invalid="true">` "Correo" | `edit, required, invalid entry, Correo` | `edición, requerido, entrada inválida, Correo` |
49
+ | `<button aria-pressed="true">Negrita</button>` | `toggle button, pressed, Negrita` | `botón conmutador, pulsado, Negrita` |
50
+ | `<nav aria-label="Menú principal">` | `Menú principal, navigation landmark` | `Menú principal, navegación región` |
51
+ | `<ul>` with 2 items | `list with 2 items` | `lista con 2 elementos` |
52
+ | `<table>` with 2 rows and 2 columns | `table with 2 rows and 2 columns` | `tabla con 2 filas y 2 columnas` |
53
+
54
+ The few role labels that the catalog does not have (such as `option`, `meter` or
55
+ `timer`) are marked in `src/labels.ts`. The NVDA workflow also runs NVDA in Spanish:
56
+ on 2026-12-02, all 36 cases matched (for example "casilla de verificación, sin
57
+ marcar", "botón de menú, contraído, submenú", "conmutador, activado", "navegación
58
+ región", "Small, botón de opción, marcado, 1 de 2").
59
+
60
+ ## Checked against real NVDA
61
+
62
+ The optional **NVDA** workflow (`.github/workflows/nvda.yml`, started by hand from the
63
+ Actions tab) runs once in English and once in Spanish (NVDA's `general.language`
64
+ setting, `NVDA_LANGUAGE=es` for the spec). It installs NVDA on a Windows runner with
65
+ [Guidepup](https://www.guidepup.dev/), reads the cases in `nvda/cases.ts` with NVDA
66
+ and Chrome, and compares what NVDA says with `announceNvda()`. Each job summary has the
67
+ table, and the `nvda-speech-en` and `nvda-speech-es` artifacts the raw results. The comparison ignores order,
68
+ punctuation and case: quick navigation says "Prices, heading, level 2" where reading
69
+ line by line says "heading level 2 Prices".
70
+
71
+ On 2026-12-02 (NVDA from Guidepup 0.40, Chrome on Windows Server 2022), **all 36
72
+ cases matched, in English and in Spanish**. Real NVDA led to these model fixes:
73
+ "menu button" for buttons with a menu popup, no "blank" for empty fields in browse
74
+ mode, "switch, on" for switches, the value of range inputs, alerts read as their
75
+ text, role first for dialogs, name first for progress bars, and images without a name
76
+ skipped (NVDA says nothing for `<img>` without alt). NVDA also reads the URL of a link
77
+ with no name ("link, blank number x").
78
+
79
+ Most cases are read line by line from a start marker; form fields, radio buttons and
80
+ tabs are reached with NVDA's own Tab, as a user tabbing (arrowing onto a field
81
+ switches NVDA to focus mode, where the arrows stop reading). Automating NVDA is not
82
+ fully reliable: a case NVDA cannot read is retried and, if it still fails, reported
83
+ as "not read", never failing the run.
84
+
85
+ To run it locally on Windows: `npx @guidepup/setup setup`, then
86
+ `npx @guidepup/setup install nvda` in this folder, build the SDK, and
87
+ `pnpm --filter @a11y-checker/screen-reader nvda`.
88
+
89
+ ## Limits
90
+
91
+ - It is a model, not a recording. NVDA's wording changes between versions, languages and
92
+ verbosity settings, and the order of the parts can differ.
93
+ - It describes one element, as when NVDA moves to it. It does not model reading a whole
94
+ page, focus mode, or live region announcements.
95
+ - Use it to see what is **missing** (a role, a name, a state). If it is missing here, it
96
+ is missing for NVDA too.
97
+
98
+ ## License
99
+
100
+ MIT.
package/dist/index.cjs ADDED
@@ -0,0 +1,477 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _a11y_checker_engine_native = require("@a11y-checker/engine-native");
3
+ let dom_accessibility_api = require("dom-accessibility-api");
4
+ // src/labels.ts
5
+ const plural = (count, one, many) => count === 1 ? one : many;
6
+ const LABELS = {
7
+ en: {
8
+ roles: {
9
+ alert: "",
10
+ alertdialog: "alert dialog",
11
+ application: "application",
12
+ article: "article",
13
+ blockquote: "block quote",
14
+ button: "button",
15
+ checkbox: "check box",
16
+ columnheader: "column header",
17
+ combobox: "combo box",
18
+ definition: "definition",
19
+ dialog: "dialog",
20
+ document: "document",
21
+ feed: "feed",
22
+ figure: "figure",
23
+ grid: "table",
24
+ group: "grouping",
25
+ img: "graphic",
26
+ image: "graphic",
27
+ link: "link",
28
+ listbox: "list",
29
+ log: "log",
30
+ marquee: "marquee",
31
+ math: "math",
32
+ menu: "menu",
33
+ menubar: "menu bar",
34
+ menuitem: "menu item",
35
+ menuitemcheckbox: "check menu item",
36
+ menuitemradio: "radio menu item",
37
+ meter: "meter",
38
+ note: "note",
39
+ option: "option",
40
+ progressbar: "progress bar",
41
+ radio: "radio button",
42
+ radiogroup: "grouping",
43
+ region: "region",
44
+ row: "row",
45
+ rowheader: "row header",
46
+ searchbox: "edit",
47
+ separator: "separator",
48
+ slider: "slider",
49
+ spinbutton: "spin button",
50
+ status: "status bar",
51
+ switch: "switch",
52
+ tab: "tab",
53
+ tablist: "tab control",
54
+ tabpanel: "property page",
55
+ term: "term",
56
+ textbox: "edit",
57
+ timer: "timer",
58
+ toolbar: "tool bar",
59
+ tooltip: "tool tip",
60
+ tree: "tree view",
61
+ treegrid: "tree view",
62
+ treeitem: "tree view item"
63
+ },
64
+ landmarks: {
65
+ banner: "banner",
66
+ complementary: "complementary",
67
+ contentinfo: "content info",
68
+ form: "form",
69
+ main: "main",
70
+ navigation: "navigation",
71
+ search: "search"
72
+ },
73
+ landmark: (name) => `${name} landmark`,
74
+ heading: (level) => `heading, level ${level}`,
75
+ list: (items) => `list with ${items} ${plural(items, "item", "items")}`,
76
+ table: (rows, columns) => `table with ${rows} ${plural(rows, "row", "rows")} and ${columns} ${plural(columns, "column", "columns")}`,
77
+ toggleButton: "toggle button",
78
+ menuButton: "menu button",
79
+ states: {
80
+ pressed: "pressed",
81
+ notPressed: "not pressed",
82
+ halfPressed: "half pressed",
83
+ checked: "checked",
84
+ notChecked: "not checked",
85
+ halfChecked: "half checked",
86
+ expanded: "expanded",
87
+ collapsed: "collapsed",
88
+ on: "on",
89
+ off: "off",
90
+ subMenu: "submenu",
91
+ opensDialog: "opens dialog",
92
+ selected: "selected",
93
+ multiLine: "multi line",
94
+ unavailable: "unavailable",
95
+ readOnly: "read only",
96
+ required: "required",
97
+ invalidEntry: "invalid entry"
98
+ },
99
+ current: {
100
+ page: "current page",
101
+ step: "current step",
102
+ location: "current location",
103
+ date: "current date",
104
+ time: "current time",
105
+ true: "current"
106
+ }
107
+ },
108
+ es: {
109
+ roles: {
110
+ alert: "",
111
+ alertdialog: "diálogo",
112
+ application: "aplicación",
113
+ article: "artículo",
114
+ blockquote: "cita",
115
+ button: "botón",
116
+ checkbox: "casilla de verificación",
117
+ columnheader: "cabecera de columna",
118
+ combobox: "cuadro combinado",
119
+ definition: "definición",
120
+ dialog: "diálogo",
121
+ document: "documento",
122
+ feed: "fuente",
123
+ figure: "figura",
124
+ grid: "tabla",
125
+ group: "agrupación",
126
+ img: "gráfico",
127
+ image: "gráfico",
128
+ link: "enlace",
129
+ listbox: "lista",
130
+ log: "registro",
131
+ marquee: "marquesina",
132
+ math: "matemáticas",
133
+ menu: "menú",
134
+ menubar: "barra de menú",
135
+ menuitem: "elemento de menú",
136
+ menuitemcheckbox: "elemento de menú marcable",
137
+ menuitemradio: "opción de elemento de menú",
138
+ meter: "medidor",
139
+ note: "nota",
140
+ option: "opción",
141
+ progressbar: "barra de progreso",
142
+ radio: "botón de opción",
143
+ radiogroup: "agrupación",
144
+ region: "región",
145
+ row: "fila",
146
+ rowheader: "cabecera de fila",
147
+ searchbox: "edición",
148
+ separator: "separador",
149
+ slider: "deslizador",
150
+ spinbutton: "botón Giratorio",
151
+ status: "barra de estado",
152
+ switch: "conmutador",
153
+ tab: "pestaña",
154
+ tablist: "lista de pestañas",
155
+ tabpanel: "página de propiedades",
156
+ term: "term",
157
+ textbox: "edición",
158
+ timer: "temporizador",
159
+ toolbar: "barra de herramientas",
160
+ tooltip: "consejo",
161
+ tree: "árbol",
162
+ treegrid: "árbol",
163
+ treeitem: "elemento de árbol"
164
+ },
165
+ landmarks: {
166
+ banner: "título",
167
+ complementary: "complementario",
168
+ contentinfo: "información de contenido",
169
+ form: "formulario",
170
+ main: "principal",
171
+ navigation: "navegación",
172
+ search: "búsqueda"
173
+ },
174
+ landmark: (name) => `${name} región`,
175
+ heading: (level) => `encabezado, nivel ${level}`,
176
+ list: (items) => `lista con ${items} ${plural(items, "elemento", "elementos")}`,
177
+ table: (rows, columns) => `tabla con ${rows} ${plural(rows, "fila", "filas")} y ${columns} ${plural(columns, "columna", "columnas")}`,
178
+ toggleButton: "botón conmutador",
179
+ menuButton: "botón de menú",
180
+ states: {
181
+ pressed: "pulsado",
182
+ notPressed: "sin pulsar",
183
+ halfPressed: "semi pulsado",
184
+ checked: "marcado",
185
+ notChecked: "sin marcar",
186
+ halfChecked: "semimarcado",
187
+ expanded: "expandido",
188
+ collapsed: "contraído",
189
+ on: "activado",
190
+ off: "desactivado",
191
+ subMenu: "submenú",
192
+ opensDialog: "abre diálogo",
193
+ selected: "seleccionado",
194
+ multiLine: "multilínea",
195
+ unavailable: "no disponible",
196
+ readOnly: "sólo lectura",
197
+ required: "requerido",
198
+ invalidEntry: "entrada inválida"
199
+ },
200
+ current: {
201
+ page: "página actual",
202
+ step: "paso actual",
203
+ location: "ubicación actual",
204
+ date: "fecha actual",
205
+ time: "hora actual",
206
+ true: "actual"
207
+ }
208
+ }
209
+ };
210
+ // src/nvda.ts
211
+ /**
212
+ * Roles NVDA announces as "<name> <role>" rather than "<role> <name>". Checked against
213
+ * real NVDA: landmarks ("Main menu, navigation landmark") and progress bars ("Upload,
214
+ * progress bar, 40"), but not dialogs ("dialog, Settings").
215
+ */
216
+ const NAME_FIRST = /* @__PURE__ */ new Set([
217
+ .../* @__PURE__ */ new Set([
218
+ "banner",
219
+ "complementary",
220
+ "contentinfo",
221
+ "form",
222
+ "main",
223
+ "navigation",
224
+ "region",
225
+ "search"
226
+ ]),
227
+ "group",
228
+ "radiogroup",
229
+ "progressbar"
230
+ ]);
231
+ /** Roles that need an accessible name to be usable (WAI-ARIA "name required"). */
232
+ const NAME_REQUIRED = /* @__PURE__ */ new Set([
233
+ "alertdialog",
234
+ "button",
235
+ "checkbox",
236
+ "columnheader",
237
+ "combobox",
238
+ "dialog",
239
+ "heading",
240
+ "img",
241
+ "image",
242
+ "link",
243
+ "listbox",
244
+ "menuitem",
245
+ "menuitemcheckbox",
246
+ "menuitemradio",
247
+ "meter",
248
+ "option",
249
+ "progressbar",
250
+ "radio",
251
+ "radiogroup",
252
+ "rowheader",
253
+ "searchbox",
254
+ "slider",
255
+ "spinbutton",
256
+ "switch",
257
+ "tab",
258
+ "textbox",
259
+ "tree",
260
+ "treeitem"
261
+ ]);
262
+ /** Elements that are never announced on their own. */
263
+ const NOT_ANNOUNCED = /* @__PURE__ */ new Set([
264
+ "html",
265
+ "head",
266
+ "body",
267
+ "title",
268
+ "meta",
269
+ "link",
270
+ "style",
271
+ "script",
272
+ "base",
273
+ "noscript",
274
+ "template"
275
+ ]);
276
+ const normalize = (text) => text.replace(/\s+/g, " ").trim();
277
+ const truncate = (text, max = 150) => text.length > max ? `${text.slice(0, max - 1)}…` : text;
278
+ const aria = (element, name) => element.getAttribute(`aria-${name}`)?.trim();
279
+ function headingLevel(element) {
280
+ const level = Number(aria(element, "level"));
281
+ if (Number.isInteger(level) && level > 0) return level;
282
+ const match = /^h([1-6])$/.exec(element.localName);
283
+ return match ? Number(match[1]) : 2;
284
+ }
285
+ /** Elements in the accessibility tree whose closest owning ancestor is `container`. */
286
+ function ownedCount(container, role, within) {
287
+ let count = 0;
288
+ for (const element of container.querySelectorAll("*")) {
289
+ if (_a11y_checker_engine_native.a11y.semanticRole(element) !== role || _a11y_checker_engine_native.a11y.isProgrammaticallyHidden(element)) continue;
290
+ let owner = element.parentElement;
291
+ while (owner && owner !== container && _a11y_checker_engine_native.a11y.semanticRole(owner) !== within) owner = owner.parentElement;
292
+ if (owner === container) count++;
293
+ }
294
+ return count;
295
+ }
296
+ function tableSize(table) {
297
+ if (table.localName === "table") {
298
+ const rows = Array.from(table.rows);
299
+ const columns = Math.max(0, ...rows.map((row) => Array.from(row.cells).reduce((sum, cell) => sum + cell.colSpan, 0)));
300
+ return {
301
+ rows: rows.length,
302
+ columns
303
+ };
304
+ }
305
+ const rows = Array.from(table.querySelectorAll("[role=\"row\"]"));
306
+ const columns = Math.max(0, ...rows.map((row) => row.querySelectorAll("[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"]").length));
307
+ return {
308
+ rows: rows.length,
309
+ columns
310
+ };
311
+ }
312
+ function isChecked(element) {
313
+ if (element.localName === "input") {
314
+ const input = element;
315
+ if (input.type === "checkbox" || input.type === "radio") {
316
+ if (input.indeterminate) return "mixed";
317
+ return input.checked ? "true" : "false";
318
+ }
319
+ }
320
+ const value = aria(element, "checked");
321
+ if (value === "true" || value === "mixed") return value;
322
+ return "false";
323
+ }
324
+ function isExpanded(element) {
325
+ if (element.localName === "summary" && element.parentElement?.localName === "details") return element.parentElement.open;
326
+ const value = aria(element, "expanded");
327
+ if (value === "true") return true;
328
+ if (value === "false") return false;
329
+ return null;
330
+ }
331
+ function states(element, role, labels) {
332
+ const result = [];
333
+ const state = labels.states;
334
+ const isTextField = role === "textbox" || role === "searchbox" || role === "combobox";
335
+ if (role === "button" && aria(element, "pressed")) {
336
+ const pressed = aria(element, "pressed");
337
+ result.push(pressed === "true" ? state.pressed : pressed === "mixed" ? state.halfPressed : state.notPressed);
338
+ }
339
+ if ([
340
+ "checkbox",
341
+ "radio",
342
+ "menuitemcheckbox",
343
+ "menuitemradio",
344
+ "switch"
345
+ ].includes(role)) {
346
+ const checked = isChecked(element);
347
+ if (role === "switch") result.push(checked === "true" ? state.on : state.off);
348
+ else if (checked === "mixed") result.push(state.halfChecked);
349
+ else if (checked === "true") result.push(state.checked);
350
+ else if (role === "checkbox" || role === "radio") result.push(state.notChecked);
351
+ }
352
+ const expanded = isExpanded(element);
353
+ if (expanded !== null) result.push(expanded ? state.expanded : state.collapsed);
354
+ const popup = aria(element, "haspopup");
355
+ if (popup === "true" || popup === "menu") result.push(state.subMenu);
356
+ else if (popup === "dialog") result.push(state.opensDialog);
357
+ if (aria(element, "selected") === "true") result.push(state.selected);
358
+ const current = aria(element, "current");
359
+ if (current && current !== "false") result.push(labels.current[current] ?? labels.current.true ?? "");
360
+ if (isTextField && element.localName === "textarea" || aria(element, "multiline") === "true") result.push(state.multiLine);
361
+ if (element.matches(":disabled") || aria(element, "disabled") === "true") result.push(state.unavailable);
362
+ if (element.hasAttribute("readonly") || aria(element, "readonly") === "true") {
363
+ if (isTextField || role === "spinbutton" || role === "grid") result.push(state.readOnly);
364
+ }
365
+ if (element.hasAttribute("required") || aria(element, "required") === "true") result.push(state.required);
366
+ const invalid = aria(element, "invalid");
367
+ if (invalid && invalid !== "false") result.push(state.invalidEntry);
368
+ return result;
369
+ }
370
+ function value(element, role) {
371
+ if (role === "textbox" || role === "searchbox" || role === "spinbutton") {
372
+ if (element.localName === "input" || element.localName === "textarea") return element.value;
373
+ }
374
+ if (role === "combobox" && element.localName === "select") return normalize(element.selectedOptions[0]?.textContent ?? "");
375
+ if ([
376
+ "slider",
377
+ "progressbar",
378
+ "meter",
379
+ "spinbutton",
380
+ "scrollbar"
381
+ ].includes(role)) {
382
+ const ariaValue = aria(element, "valuetext") || aria(element, "valuenow");
383
+ if (ariaValue) return ariaValue;
384
+ if (element.localName === "input") return element.value;
385
+ return "";
386
+ }
387
+ return "";
388
+ }
389
+ function roleLabel(element, role, name, labels) {
390
+ if (role === "region" && !name) return "";
391
+ if (role === "form" && !name) return "";
392
+ if (role === "button" && aria(element, "pressed")) return labels.toggleButton;
393
+ const popup = aria(element, "haspopup");
394
+ if (role === "button" && (popup === "true" || popup === "menu")) return labels.menuButton;
395
+ if (role === "heading") return labels.heading(headingLevel(element));
396
+ if (role === "list") return labels.list(ownedCount(element, "listitem", "list"));
397
+ if (role === "listbox") return labels.list(ownedCount(element, "option", "listbox"));
398
+ if (role === "table" || role === "grid" || role === "treegrid") {
399
+ const { rows, columns } = tableSize(element);
400
+ return labels.table(rows, columns);
401
+ }
402
+ const landmark = labels.landmarks[role];
403
+ if (landmark) return labels.landmark(landmark);
404
+ return labels.roles[role] ?? "";
405
+ }
406
+ const silent = (language, role, name = "") => ({
407
+ reader: "nvda",
408
+ language,
409
+ role,
410
+ name,
411
+ speech: "",
412
+ silent: true,
413
+ missingName: false
414
+ });
415
+ /**
416
+ * What NVDA announces for an element in browse mode (with Chrome), in English or, with
417
+ * `{ language: 'es' }`, in Spanish.
418
+ * Returns `null` for document-level elements that are never announced on their own,
419
+ * like `<html>`, `<head>` or `<meta>`.
420
+ *
421
+ * @example
422
+ * announceNvda(document.querySelector('h2')) // { speech: 'heading, level 2, Prices', … }
423
+ * announceNvda(document.querySelector('button.icon')) // { speech: 'button', missingName: true, … }
424
+ * announceNvda(document.querySelector('h2'), { language: 'es' }) // { speech: 'encabezado, nivel 2, Precios', … }
425
+ */
426
+ function announceNvda(element, options = {}) {
427
+ const language = options.language ?? "en";
428
+ const labels = LABELS[language];
429
+ if (NOT_ANNOUNCED.has(element.localName)) return null;
430
+ if (_a11y_checker_engine_native.a11y.isProgrammaticallyHidden(element)) return silent(language, _a11y_checker_engine_native.a11y.semanticRole(element));
431
+ const role = _a11y_checker_engine_native.a11y.semanticRole(element);
432
+ const name = _a11y_checker_engine_native.a11y.accessibleName(element);
433
+ const textOnly = () => {
434
+ const text = truncate(normalize(element.textContent));
435
+ return text ? {
436
+ reader: "nvda",
437
+ language,
438
+ role,
439
+ name,
440
+ speech: text,
441
+ silent: false,
442
+ missingName: false
443
+ } : silent(language, role, name);
444
+ };
445
+ if (!role || role === "none" || role === "presentation" || role === "generic") return textOnly();
446
+ if ((role === "img" || role === "image") && !name) return {
447
+ ...silent(language, role),
448
+ missingName: true
449
+ };
450
+ const label = roleLabel(element, role, name, labels);
451
+ if (!label && !name && !NAME_REQUIRED.has(role)) return textOnly();
452
+ const parts = [];
453
+ const nameFirst = NAME_FIRST.has(role);
454
+ if (nameFirst && name) parts.push(name);
455
+ if (label) parts.push(label);
456
+ parts.push(...states(element, role, labels));
457
+ if (!nameFirst && name) parts.push(truncate(name));
458
+ const current = value(element, role);
459
+ if (current && current !== name) parts.push(truncate(current));
460
+ const description = normalize((0, dom_accessibility_api.computeAccessibleDescription)(element));
461
+ if (description && description !== name) parts.push(truncate(description));
462
+ const speech = parts.join(", ");
463
+ const missingName = NAME_REQUIRED.has(role) && !name;
464
+ return {
465
+ reader: "nvda",
466
+ language,
467
+ role,
468
+ name,
469
+ speech,
470
+ silent: speech === "",
471
+ missingName
472
+ };
473
+ }
474
+ exports.LABELS = LABELS;
475
+ exports.announceNvda = announceNvda;
476
+
477
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["a11y","select","computeAccessibleDescription"],"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,MA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