pour-engine 1.42.3 → 1.42.4

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.
@@ -6,6 +6,6 @@
6
6
  export default {
7
7
  engine: {
8
8
  name: 'pour engine',
9
- version: '1.42.3',
9
+ version: '1.42.4',
10
10
  },
11
11
  };
@@ -16,8 +16,24 @@ const TEXT_INPUT = new Set(['text', 'search', 'url', 'tel', 'email', 'password',
16
16
  * labels through ElementInternals, so they are not reachable here). */
17
17
  const LABELABLE = new Set(['input', 'select', 'textarea', 'button', 'meter', 'output', 'progress']);
18
18
 
19
+ /** A name made only of characters nothing can speak is no name. Private
20
+ * Use Area code points (U+E000 to U+F8FF and the two supplementary planes)
21
+ * carry no interoperable meaning by definition (Unicode, chapter 23:
22
+ * "their interpretation is not specified"); icon fonts put their glyphs
23
+ * there, so a button whose only content is an icon's ::before glyph
24
+ * (postgresql.org's search and theme buttons, Font Awesome U+F002 and
25
+ * U+F0EB, 2026-09-14) has a name string the browser exposes and a screen
26
+ * reader announces as nothing. WCAG's name is "text by which software can
27
+ * identify a component within Web content to the user"; a private-use
28
+ * glyph identifies nothing to anyone. Zero-width and joiner characters
29
+ * are stripped for the same reason. Every other character, symbols and
30
+ * emoji included, still names: "×" is spoken. */
31
+ function speakable(name) {
32
+ return name.replace(/[\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}\u200B-\u200D\u2060\uFEFF]/gu, '').trim() ? name : '';
33
+ }
34
+
19
35
  export function accessibleName(element) {
20
- return computeName(element, false, false, new Set());
36
+ return speakable(computeName(element, false, false, new Set()));
21
37
  }
22
38
 
23
39
  /** The name aria-labelledby contributes, resolved the way accname requires:
@@ -26,12 +42,12 @@ export function accessibleName(element) {
26
42
  * too, and reading textContent instead reports those elements as nameless.
27
43
  * Rules that only need "is it labelled?" call this directly. */
28
44
  export function labelledByName(element) {
29
- return referencedName(element, new Set()) ?? '';
45
+ return speakable(referencedName(element, new Set()) ?? '');
30
46
  }
31
47
 
32
48
  /** Native label text, excluding the control being named from recursion. */
33
49
  export function nativeLabelName(element, label) {
34
- return computeName(label, false, hiddenForName(label), new Set([element]));
50
+ return speakable(computeName(label, false, hiddenForName(label), new Set([element])));
35
51
  }
36
52
 
37
53
  // Accname 2A: only a reference whose root is itself hidden includes its
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pour-engine",
3
- "version": "1.42.3",
3
+ "version": "1.42.4",
4
4
  "description": "Accessibility (WCAG 2.2) audit engine written from the W3C specifications — runs entirely in the browser, no dependencies.",
5
5
  "type": "module",
6
6
  "main": "engine/index.js",