@ngbracket/a11y-devtools 0.15.7 → 0.16.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All notable changes to `@ngbracket/a11y-devtools` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## 0.16.0
7
+
8
+ ### Added
9
+
10
+ - New keyboard rule `ngbr/hover-only-content`. It reports an element that shows
11
+ content on hover when Tab can't reach it, so keyboard users may never see that
12
+ content. An info icon with a tooltip in a table row is the common case. The
13
+ rule looks for:
14
+ - a tooltip from Angular Material, PrimeNG, ng-bootstrap, ngx-bootstrap,
15
+ ng-zorro, Taiga UI or helipopper, by its directive class in a dev build or
16
+ by its attribute or host class in any build. Moderate. An empty tooltip
17
+ attribute is skipped in every build. In a dev build, a tooltip switched off
18
+ through its directive is skipped too (Material, PrimeNG, ng-bootstrap,
19
+ ngx-bootstrap, ng-zorro and helipopper), and so is Material's
20
+ `matTooltipDisabled` in any build.
21
+ - an HTML `interestfor` attribute. Moderate.
22
+ - an Angular `(mouseenter)`, `(mouseover)`, `(pointerenter)` or
23
+ `(pointerover)` listener (dev builds). Minor, since such a listener can also
24
+ do something else, such as highlight a row.
25
+ - a `title` on an icon with no visible text, unless it repeats the icon's
26
+ `alt` or `aria-label`. Minor.
27
+
28
+ A disabled control with a tooltip, or a wrapper around one, gets its own
29
+ message: a disabled control can't take focus, so use `aria-disabled="true"`
30
+ instead. The rule skips an element inside something Tab reaches (an icon in a
31
+ link), a wrapper around something Tab reaches, and anything inside an
32
+ element already reported. It runs with the keyboard layer and maps to WCAG
33
+ 2.1.1 in the ACR worksheet. Like the other keyboard rules, it is a heuristic
34
+ to check by hand.
35
+
36
+ If you gate CI on a baseline, findings from this rule show as new after you
37
+ upgrade. Update the baseline once you've checked them.
38
+
39
+ ### Fixed
40
+
41
+ - The overlay now draws each keyboard finding on its own element. Keyboard
42
+ findings use a short selector such as `mat-icon.info`, and when that matched
43
+ an element repeated in every table row, the overlay drew all the findings on
44
+ the first match. Findings now carry a `locator` as well: a selector that
45
+ matches only that element, which the overlay uses. `target` is unchanged, so
46
+ baselines are unaffected.
47
+
48
+ ## 0.15.8
49
+
50
+ ### Fixed
51
+
52
+ - Report mode now checks colour contrast below the fold when the app runs the
53
+ in-app overlay. The overlay's tab-order path is drawn on a fixed SVG that
54
+ runs past the bottom of the viewport. axe counted it as covering the text
55
+ there, so its contrast check returned "needs review" instead of a result,
56
+ and report mode doesn't list those. Contrast problems on parts of a page
57
+ below the report's 900px-tall viewport could go unreported, in light and
58
+ dark passes. Report mode now hides the overlay before it scans. On the
59
+ public demo this brings back two dark-mode contrast failures the dark pass
60
+ had missed.
61
+
6
62
  ## 0.15.7
7
63
 
8
64
  ### Fixed
@@ -76,3 +76,12 @@ export declare function resolveOwningComponentName(node: Element, frameworkPrefi
76
76
  * can't see. Empty when the debug global is absent or the node has none.
77
77
  */
78
78
  export declare function resolveDirectiveNames(node: Element): string[];
79
+ /**
80
+ * The directive instances on `node` with their names, for checks that need to
81
+ * look at an instance (e.g. to tell PrimeNG's `Tooltip` from another library's
82
+ * class of the same name). Empty when the debug global is absent.
83
+ */
84
+ export declare function resolveDirectives(node: Element): {
85
+ name: string;
86
+ instance: object;
87
+ }[];
@@ -122,6 +122,14 @@ export function resolveOwningComponentName(node, frameworkPrefixes = DEFAULT_FRA
122
122
  * can't see. Empty when the debug global is absent or the node has none.
123
123
  */
124
124
  export function resolveDirectiveNames(node) {
125
+ return resolveDirectives(node).map((d) => d.name);
126
+ }
127
+ /**
128
+ * The directive instances on `node` with their names, for checks that need to
129
+ * look at an instance (e.g. to tell PrimeNG's `Tooltip` from another library's
130
+ * class of the same name). Empty when the debug global is absent.
131
+ */
132
+ export function resolveDirectives(node) {
125
133
  const ng = ngDebug();
126
134
  if (!ng?.getDirectives)
127
135
  return [];
@@ -132,11 +140,11 @@ export function resolveDirectiveNames(node) {
132
140
  catch {
133
141
  return []; // node isn't part of a live view
134
142
  }
135
- const names = [];
143
+ const found = [];
136
144
  for (const directive of directives) {
137
145
  const name = nameOf(directive);
138
146
  if (name)
139
- names.push(name);
147
+ found.push({ name, instance: directive });
140
148
  }
141
- return names;
149
+ return found;
142
150
  }
@@ -34204,6 +34204,9 @@
34204
34204
  return appComponentFromPath(resolveComponentPath(node), frameworkPrefixes);
34205
34205
  }
34206
34206
  function resolveDirectiveNames(node) {
34207
+ return resolveDirectives(node).map((d) => d.name);
34208
+ }
34209
+ function resolveDirectives(node) {
34207
34210
  const ng = ngDebug();
34208
34211
  if (!ng?.getDirectives)
34209
34212
  return [];
@@ -34213,13 +34216,13 @@
34213
34216
  } catch {
34214
34217
  return [];
34215
34218
  }
34216
- const names = [];
34219
+ const found = [];
34217
34220
  for (const directive of directives) {
34218
34221
  const name = nameOf(directive);
34219
34222
  if (name)
34220
- names.push(name);
34223
+ found.push({ name, instance: directive });
34221
34224
  }
34222
- return names;
34225
+ return found;
34223
34226
  }
34224
34227
 
34225
34228
  // dist/top-layer.js
@@ -34439,7 +34442,7 @@
34439
34442
  function render(findings) {
34440
34443
  clear();
34441
34444
  for (const finding of findings) {
34442
- const target = resolveTarget(doc, finding.target);
34445
+ const target = resolveTarget(doc, finding.locator ?? finding.target);
34443
34446
  if (!target)
34444
34447
  continue;
34445
34448
  const box = buildBox(doc, finding);
@@ -34822,6 +34825,126 @@
34822
34825
  return results;
34823
34826
  }
34824
34827
 
34828
+ // dist/keyboard/hover-content.js
34829
+ var empty = (value) => value == null || String(value).trim() === "";
34830
+ var TOOLTIP_LIBRARIES = [
34831
+ // Angular Material
34832
+ {
34833
+ directives: ["MatTooltip"],
34834
+ selector: ".mat-mdc-tooltip-trigger, [mattooltip]",
34835
+ textAttribute: "mattooltip",
34836
+ isOff: (d) => d["disabled"] === true || empty(d["message"])
34837
+ },
34838
+ // PrimeNG
34839
+ {
34840
+ directives: [],
34841
+ genericDirectives: ["Tooltip"],
34842
+ instanceKeys: ["tooltipPosition"],
34843
+ selector: "[ptooltip]",
34844
+ textAttribute: "ptooltip",
34845
+ isOff: (d) => d["tooltipDisabled"] === true || d["disabled"] === true
34846
+ },
34847
+ // ng-bootstrap
34848
+ {
34849
+ directives: ["NgbTooltip"],
34850
+ selector: "[ngbtooltip]",
34851
+ textAttribute: "ngbtooltip",
34852
+ isOff: (d) => d["disableTooltip"] === true || empty(d["ngbTooltip"])
34853
+ },
34854
+ // ngx-bootstrap
34855
+ {
34856
+ directives: [],
34857
+ genericDirectives: ["TooltipDirective"],
34858
+ instanceKeys: ["tooltip"],
34859
+ selector: "[tooltip]",
34860
+ textAttribute: "tooltip",
34861
+ genericMarker: true,
34862
+ isOff: (d) => d["isDisabled"] === true || empty(d["tooltip"])
34863
+ },
34864
+ // ng-zorro
34865
+ {
34866
+ directives: ["NzTooltipDirective"],
34867
+ selector: "[nz-tooltip]",
34868
+ isOff: (d) => "nzTooltipTitle" in d && empty(d["nzTooltipTitle"])
34869
+ },
34870
+ // Taiga UI
34871
+ { directives: ["TuiHint", "TuiHintDirective", "TuiHintHover"], selector: "[tuihint]", textAttribute: "tuihint" },
34872
+ // @ngneat/helipopper (Tippy.js)
34873
+ {
34874
+ directives: ["TippyDirective"],
34875
+ selector: "[tp]",
34876
+ textAttribute: "tp",
34877
+ genericMarker: true,
34878
+ isOff: (d) => d["tpIsEnabled"] === false
34879
+ },
34880
+ // HTML interest invokers
34881
+ { directives: [], selector: "[interestfor]" }
34882
+ ];
34883
+ var ANY_MARKER = TOOLTIP_LIBRARIES.map((lib) => lib.selector).join(", ");
34884
+ var HOVER_EVENTS = ["mouseenter", "mouseover", "pointerenter", "pointerover"];
34885
+ var ICON_CLASS = /^(mat-icon|material-icons(-[\w-]+)?|material-symbols-\w+|fa-[\w-]+|fa[srlbdt]|fa-solid|fa-regular|bi-[\w-]+|pi-[\w-]+|glyphicon-[\w-]+)$/;
34886
+ function hasTooltip(element) {
34887
+ let marked = false;
34888
+ try {
34889
+ marked = element.matches(ANY_MARKER);
34890
+ } catch {
34891
+ marked = false;
34892
+ }
34893
+ if (marked && element.classList.contains("mat-mdc-tooltip-disabled"))
34894
+ return false;
34895
+ const directives = resolveDirectives(element);
34896
+ for (const lib of TOOLTIP_LIBRARIES) {
34897
+ const found = directives.find((d) => lib.directives.includes(d.name) || lib.genericDirectives?.includes(d.name) && (safeMatches2(element, lib.selector) || (lib.instanceKeys ?? []).some((key) => key in d.instance)));
34898
+ if (found) {
34899
+ if (lib.isOff?.(found.instance) || emptyTextAttribute(element, lib))
34900
+ continue;
34901
+ return true;
34902
+ }
34903
+ if (!marked || !safeMatches2(element, lib.selector))
34904
+ continue;
34905
+ if (directives.length > 0 && lib.directives.length + (lib.genericDirectives?.length ?? 0) > 0)
34906
+ continue;
34907
+ if (lib.genericMarker && globalThis.customElements?.get(element.localName) !== void 0)
34908
+ continue;
34909
+ if (emptyTextAttribute(element, lib))
34910
+ continue;
34911
+ return true;
34912
+ }
34913
+ return false;
34914
+ }
34915
+ function emptyTextAttribute(element, lib) {
34916
+ return !!lib.textAttribute && element.hasAttribute(lib.textAttribute) && empty(element.getAttribute(lib.textAttribute));
34917
+ }
34918
+ function safeMatches2(element, selector) {
34919
+ try {
34920
+ return element.matches(selector);
34921
+ } catch {
34922
+ return false;
34923
+ }
34924
+ }
34925
+ function isIconLike(element) {
34926
+ const tag = element.tagName.toLowerCase();
34927
+ if (tag === "svg" || tag === "img" || tag === "mat-icon")
34928
+ return true;
34929
+ if ([...element.classList].some((c) => ICON_CLASS.test(c)))
34930
+ return true;
34931
+ return (element.textContent ?? "").trim() === "";
34932
+ }
34933
+ function titleRepeatsName(element, title) {
34934
+ const norm = (v) => (v ?? "").trim().toLowerCase();
34935
+ return [element.getAttribute("alt"), element.getAttribute("aria-label")].some((n) => norm(n) === norm(title));
34936
+ }
34937
+ function hoverSignal(element, events) {
34938
+ if (hasTooltip(element))
34939
+ return "tooltip";
34940
+ if (events.some((e) => HOVER_EVENTS.includes(e.split(".")[0])))
34941
+ return "hover-listener";
34942
+ const title = (element.getAttribute("title") ?? "").trim();
34943
+ if (title !== "" && isIconLike(element) && !titleRepeatsName(element, title))
34944
+ return "title";
34945
+ return null;
34946
+ }
34947
+
34825
34948
  // dist/keyboard/keyboard-scan.js
34826
34949
  var INTERACTIVE_ROLES = /* @__PURE__ */ new Set([
34827
34950
  "button",
@@ -34945,6 +35068,13 @@
34945
35068
  return false;
34946
35069
  }
34947
35070
  }
35071
+ function hasTabbableOrFlaggedAncestor(element, flagged, isVisible) {
35072
+ for (let el = element.parentElement; el; el = el.parentElement) {
35073
+ if (flagged.has(el) || isTabbable(el, isVisible))
35074
+ return true;
35075
+ }
35076
+ return false;
35077
+ }
34948
35078
  var ITEM_SELECTOR = [...INTERACTIVE_ROLES].map((role) => `[role="${role}"]`).join(",");
34949
35079
  function partOfKeyboardOperatedWidget(element, isVisible, keyCache, sharedCache) {
34950
35080
  const item = element.parentElement?.closest(ITEM_SELECTOR);
@@ -34967,6 +35097,38 @@
34967
35097
  const classes = (element.getAttribute("class") ?? "").trim().split(/\s+/).filter(Boolean).slice(0, 2);
34968
35098
  return classes.length ? `${tag}.${classes.join(".")}` : tag;
34969
35099
  }
35100
+ function uniqueLocator(element) {
35101
+ const doc = element.ownerDocument;
35102
+ const escape = globalThis.CSS?.escape;
35103
+ if (!doc || typeof escape !== "function" || element.getRootNode() !== doc)
35104
+ return void 0;
35105
+ const count = (selector) => {
35106
+ try {
35107
+ return doc.querySelectorAll(selector).length;
35108
+ } catch {
35109
+ return 0;
35110
+ }
35111
+ };
35112
+ const short = shortSelector(element);
35113
+ if (count(short) === 1 && doc.querySelector(short) === element)
35114
+ return void 0;
35115
+ const step = (el) => {
35116
+ if (el.id && count(`#${escape(el.id)}`) === 1)
35117
+ return { text: `#${escape(el.id)}`, anchored: true };
35118
+ const classes = [...el.classList].slice(0, 2).map((c) => `.${escape(c)}`).join("");
35119
+ const index = el.parentElement ? [...el.parentElement.children].indexOf(el) + 1 : 1;
35120
+ return { text: `${el.tagName.toLowerCase()}${classes}:nth-child(${index})`, anchored: false };
35121
+ };
35122
+ const steps = [];
35123
+ for (let el = element; el && el !== doc.documentElement; el = el.parentElement) {
35124
+ const { text, anchored } = step(el);
35125
+ steps.unshift(text);
35126
+ const selector = steps.join(" > ");
35127
+ if (anchored || count(selector) === 1)
35128
+ return selector;
35129
+ }
35130
+ return void 0;
35131
+ }
34970
35132
  function shortHtml(element) {
34971
35133
  const html = element.outerHTML ?? "";
34972
35134
  return html.length > 160 ? `${html.slice(0, 159)}\u2026` : html;
@@ -34977,6 +35139,29 @@
34977
35139
  const findings = [];
34978
35140
  const keyCache = /* @__PURE__ */ new Map();
34979
35141
  const sharedCache = /* @__PURE__ */ new Map();
35142
+ const unreachable = /* @__PURE__ */ new Set();
35143
+ const listenerEvents = /* @__PURE__ */ new Map();
35144
+ const eventsOf = (el) => {
35145
+ let events = listenerEvents.get(el);
35146
+ if (!events)
35147
+ listenerEvents.set(el, events = resolveListenerEvents(el));
35148
+ return events;
35149
+ };
35150
+ const hoverFinding = (element, signal) => {
35151
+ const url = `${RULE_DOCS}/hover-only-content`;
35152
+ const only = element.children.length === 1 ? element.children[0] : null;
35153
+ const disabled = isNativelyFocusable(element) && isDisabled(element) ? element : signal === "tooltip" ? [...element.querySelectorAll("button, input, select, textarea")].find(isDisabled) : only && isNativelyFocusable(only) && isDisabled(only) ? only : void 0;
35154
+ if (disabled) {
35155
+ return make(element, "ngbr/hover-only-content", signal === "tooltip" ? "moderate" : "minor", `Keyboard users may not see this disabled control's hover content: a disabled control can't take focus, so its tooltip only opens for the mouse. Use aria-disabled="true" instead of disabled, or show the reason as text. Heuristic \u2014 verify manually.`, url);
35156
+ }
35157
+ if (signal === "title") {
35158
+ return make(element, "ngbr/hover-only-content", "minor", `Only mouse users see this icon's title: Tab doesn't reach the icon, so keyboard users can't show its title. Show the text on the page, or put the icon in a focusable control with a visible label or tooltip. Heuristic \u2014 verify manually.`, url);
35159
+ }
35160
+ if (signal === "hover-listener") {
35161
+ return make(element, "ngbr/hover-only-content", "minor", `Keyboard users may not see what this shows on hover: it listens for the mouse moving over it, but Tab doesn't reach it. If it shows content, make it focusable and show the content on focus too, or show it on the page. Heuristic \u2014 verify manually.`, url);
35162
+ }
35163
+ return make(element, "ngbr/hover-only-content", "moderate", `Keyboard users may not see this tooltip: it opens on hover, but Tab doesn't reach it. Make it focusable (a <button>, or tabindex="0") and check the tooltip opens on focus, or show the text on the page. Heuristic \u2014 verify manually.`, url);
35164
+ };
34980
35165
  const make = (element, id, impact, help, helpUrl) => {
34981
35166
  const componentPath = resolveComponentPath(element);
34982
35167
  return {
@@ -34988,6 +35173,7 @@
34988
35173
  componentPath,
34989
35174
  directives: resolveDirectiveNames(element),
34990
35175
  target: shortSelector(element),
35176
+ locator: uniqueLocator(element),
34991
35177
  html: shortHtml(element)
34992
35178
  };
34993
35179
  };
@@ -34999,7 +35185,7 @@
34999
35185
  if (isNativelyFocusable(element))
35000
35186
  continue;
35001
35187
  const role = element.getAttribute("role")?.toLowerCase() ?? "";
35002
- const events = resolveListenerEvents(element);
35188
+ const events = eventsOf(element);
35003
35189
  const hasClick = events.includes("click");
35004
35190
  const interactiveByRole = INTERACTIVE_ROLES.has(role);
35005
35191
  if (!hasClick && !interactiveByRole)
@@ -35017,9 +35203,11 @@
35017
35203
  continue;
35018
35204
  if (within === "no-keys") {
35019
35205
  findings.push(make(element, "ngbr/unreachable-control", "moderate", `Keyboard users may not be able to reach this item: it has role="${role}" and is out of the tab order, like a roving-tabindex item, but nothing in or around its widget handles keys, so arrow keys may not move to it. Handle the arrow keys, or use aria-activedescendant. Heuristic \u2014 verify manually.`, `${RULE_DOCS}/unreachable-control`));
35206
+ unreachable.add(element);
35020
35207
  continue;
35021
35208
  }
35022
35209
  const reason = interactiveByRole ? `has role="${role}"` : "has a click handler";
35210
+ unreachable.add(element);
35023
35211
  findings.push(make(element, "ngbr/unreachable-control", "serious", `Keyboard users can't reach this control: it ${reason}, but it isn't a native control and has no tabindex="0", so Tab skips it. Use a <button> or <a href>, or add tabindex="0" and Enter/Space handling.`, `${RULE_DOCS}/unreachable-control`));
35024
35212
  continue;
35025
35213
  }
@@ -35028,6 +35216,26 @@
35028
35216
  findings.push(make(element, "ngbr/click-without-key", "moderate", `Keyboard users may not be able to activate this: Tab reaches it, but it only listens for click, and Enter and Space don't fire click on a non-native element. Use a <button>, or handle Enter and Space too. Heuristic \u2014 verify manually.`, `${RULE_DOCS}/click-without-key`));
35029
35217
  }
35030
35218
  }
35219
+ const hoverFlagged = new Set(unreachable);
35220
+ for (const element of root.querySelectorAll("*")) {
35221
+ if (modal && !modal.contains(element))
35222
+ continue;
35223
+ if (hoverFlagged.has(element) || element.closest(OVERLAY_EXCLUDE_SELECTOR))
35224
+ continue;
35225
+ const signal = hoverSignal(element, eventsOf(element));
35226
+ if (!signal)
35227
+ continue;
35228
+ if (isTabbable(element, isVisible) || isHidden(element, isVisible))
35229
+ continue;
35230
+ if (hasTabbableDescendant(element, isVisible))
35231
+ continue;
35232
+ if (hasTabbableOrFlaggedAncestor(element, hoverFlagged, isVisible))
35233
+ continue;
35234
+ if (reachedWithinWidget(element, isVisible, keyCache, sharedCache) === "reached")
35235
+ continue;
35236
+ hoverFlagged.add(element);
35237
+ findings.push(hoverFinding(element, signal));
35238
+ }
35031
35239
  for (const modal2 of findUncontainedModals(root, { frameworkPrefixes: prefixes, isVisible })) {
35032
35240
  findings.push(make(modal2.element, "ngbr/modal-focus-not-contained", "moderate", `Keyboard users can Tab out of this modal: it has aria-modal="true", but ${modal2.outsideCount} control(s) outside it can still be reached with Tab. Open it with <dialog>.showModal(), make the rest of the page inert, or trap focus. Heuristic \u2014 verify manually.`, `${RULE_DOCS}/modal-focus-not-contained`));
35033
35241
  }
@@ -0,0 +1,14 @@
1
+ /** How an element shows content on hover. */
2
+ export type HoverSignal = 'tooltip' | 'hover-listener' | 'title';
3
+ /**
4
+ * True when `element` shows no text of its own: no text content, an `<svg>` or
5
+ * `<img>`, or an icon-font element whose text is a ligature (`<mat-icon>info</mat-icon>`).
6
+ */
7
+ export declare function isIconLike(element: Element): boolean;
8
+ /**
9
+ * The strongest hover signal on `element`: a tooltip that's switched on, then an
10
+ * Angular hover listener, then a `title` on an icon. `events` are the Angular
11
+ * listener names on it (see `resolveListenerEvents`), passed in so a scan reads
12
+ * them once.
13
+ */
14
+ export declare function hoverSignal(element: Element, events: readonly string[]): HoverSignal | null;
@@ -0,0 +1,161 @@
1
+ /**
2
+ * What marks an element as showing content on hover: a tooltip directive from a
3
+ * known library, an Angular hover listener, or a native `title` on an icon. The
4
+ * keyboard scan reports such an element when Tab can't reach it, since keyboard
5
+ * users then never see that content (`ngbr/hover-only-content`).
6
+ *
7
+ * Tooltip libraries attach their mouse listeners with `addEventListener`, which
8
+ * Angular's `getListeners` can't see, so each library is recognised by its
9
+ * directive class (dev builds) or by a DOM marker that's there in production
10
+ * too: a host class, or the attribute Angular renders for a static input
11
+ * (`matTooltip="Info"` → `mattooltip="Info"`).
12
+ */
13
+ import { resolveDirectives } from '../attribution.js';
14
+ const empty = (value) => value == null || String(value).trim() === '';
15
+ /** Tooltip directives we recognise. Popovers are left out: most open on click. */
16
+ const TOOLTIP_LIBRARIES = [
17
+ // Angular Material
18
+ {
19
+ directives: ['MatTooltip'],
20
+ selector: '.mat-mdc-tooltip-trigger, [mattooltip]',
21
+ textAttribute: 'mattooltip',
22
+ isOff: (d) => d['disabled'] === true || empty(d['message']),
23
+ },
24
+ // PrimeNG
25
+ {
26
+ directives: [],
27
+ genericDirectives: ['Tooltip'],
28
+ instanceKeys: ['tooltipPosition'],
29
+ selector: '[ptooltip]',
30
+ textAttribute: 'ptooltip',
31
+ isOff: (d) => d['tooltipDisabled'] === true || d['disabled'] === true,
32
+ },
33
+ // ng-bootstrap
34
+ {
35
+ directives: ['NgbTooltip'],
36
+ selector: '[ngbtooltip]',
37
+ textAttribute: 'ngbtooltip',
38
+ isOff: (d) => d['disableTooltip'] === true || empty(d['ngbTooltip']),
39
+ },
40
+ // ngx-bootstrap
41
+ {
42
+ directives: [],
43
+ genericDirectives: ['TooltipDirective'],
44
+ instanceKeys: ['tooltip'],
45
+ selector: '[tooltip]',
46
+ textAttribute: 'tooltip',
47
+ genericMarker: true,
48
+ isOff: (d) => d['isDisabled'] === true || empty(d['tooltip']),
49
+ },
50
+ // ng-zorro
51
+ {
52
+ directives: ['NzTooltipDirective'],
53
+ selector: '[nz-tooltip]',
54
+ isOff: (d) => 'nzTooltipTitle' in d && empty(d['nzTooltipTitle']),
55
+ },
56
+ // Taiga UI
57
+ { directives: ['TuiHint', 'TuiHintDirective', 'TuiHintHover'], selector: '[tuihint]', textAttribute: 'tuihint' },
58
+ // @ngneat/helipopper (Tippy.js)
59
+ {
60
+ directives: ['TippyDirective'],
61
+ selector: '[tp]',
62
+ textAttribute: 'tp',
63
+ genericMarker: true,
64
+ isOff: (d) => d['tpIsEnabled'] === false,
65
+ },
66
+ // HTML interest invokers
67
+ { directives: [], selector: '[interestfor]' },
68
+ ];
69
+ /** Every marker in one selector, so most elements cost a single `matches()`. */
70
+ const ANY_MARKER = TOOLTIP_LIBRARIES.map((lib) => lib.selector).join(', ');
71
+ const HOVER_EVENTS = ['mouseenter', 'mouseover', 'pointerenter', 'pointerover'];
72
+ /**
73
+ * Icon-font classes whose text is a ligature or glyph name, not visible text:
74
+ * Material Icons and Symbols, Font Awesome, Bootstrap Icons, PrimeIcons, Glyphicons.
75
+ */
76
+ const ICON_CLASS = /^(mat-icon|material-icons(-[\w-]+)?|material-symbols-\w+|fa-[\w-]+|fa[srlbdt]|fa-solid|fa-regular|bi-[\w-]+|pi-[\w-]+|glyphicon-[\w-]+)$/;
77
+ /**
78
+ * True when a tooltip from a known library is on `element` and switched on. A
79
+ * dev build answers from the directive instance; otherwise from the markers.
80
+ */
81
+ function hasTooltip(element) {
82
+ let marked = false;
83
+ try {
84
+ marked = element.matches(ANY_MARKER);
85
+ }
86
+ catch {
87
+ marked = false; // a selector this DOM implementation can't parse
88
+ }
89
+ // Material marks a tooltip that's switched off; this works in production too.
90
+ if (marked && element.classList.contains('mat-mdc-tooltip-disabled'))
91
+ return false;
92
+ const directives = resolveDirectives(element);
93
+ for (const lib of TOOLTIP_LIBRARIES) {
94
+ const found = directives.find((d) => lib.directives.includes(d.name) ||
95
+ (lib.genericDirectives?.includes(d.name) &&
96
+ (safeMatches(element, lib.selector) || (lib.instanceKeys ?? []).some((key) => key in d.instance))));
97
+ if (found) {
98
+ if (lib.isOff?.(found.instance) || emptyTextAttribute(element, lib))
99
+ continue;
100
+ return true;
101
+ }
102
+ if (!marked || !safeMatches(element, lib.selector))
103
+ continue;
104
+ // A marker with no directive: production, or something else using the attribute.
105
+ if (directives.length > 0 && lib.directives.length + (lib.genericDirectives?.length ?? 0) > 0)
106
+ continue;
107
+ // A registered web component may use the attribute for something else.
108
+ // Angular component hosts aren't registered custom elements, so they still count.
109
+ if (lib.genericMarker && globalThis.customElements?.get(element.localName) !== undefined)
110
+ continue;
111
+ if (emptyTextAttribute(element, lib))
112
+ continue;
113
+ return true;
114
+ }
115
+ return false;
116
+ }
117
+ /** The library's text attribute is on `element` but empty: no tooltip text. */
118
+ function emptyTextAttribute(element, lib) {
119
+ return !!lib.textAttribute && element.hasAttribute(lib.textAttribute) && empty(element.getAttribute(lib.textAttribute));
120
+ }
121
+ function safeMatches(element, selector) {
122
+ try {
123
+ return element.matches(selector);
124
+ }
125
+ catch {
126
+ return false;
127
+ }
128
+ }
129
+ /**
130
+ * True when `element` shows no text of its own: no text content, an `<svg>` or
131
+ * `<img>`, or an icon-font element whose text is a ligature (`<mat-icon>info</mat-icon>`).
132
+ */
133
+ export function isIconLike(element) {
134
+ const tag = element.tagName.toLowerCase();
135
+ if (tag === 'svg' || tag === 'img' || tag === 'mat-icon')
136
+ return true;
137
+ if ([...element.classList].some((c) => ICON_CLASS.test(c)))
138
+ return true;
139
+ return (element.textContent ?? '').trim() === '';
140
+ }
141
+ /** A `title` that adds nothing to the element's `alt` or `aria-label`. */
142
+ function titleRepeatsName(element, title) {
143
+ const norm = (v) => (v ?? '').trim().toLowerCase();
144
+ return [element.getAttribute('alt'), element.getAttribute('aria-label')].some((n) => norm(n) === norm(title));
145
+ }
146
+ /**
147
+ * The strongest hover signal on `element`: a tooltip that's switched on, then an
148
+ * Angular hover listener, then a `title` on an icon. `events` are the Angular
149
+ * listener names on it (see `resolveListenerEvents`), passed in so a scan reads
150
+ * them once.
151
+ */
152
+ export function hoverSignal(element, events) {
153
+ if (hasTooltip(element))
154
+ return 'tooltip';
155
+ if (events.some((e) => HOVER_EVENTS.includes(e.split('.')[0])))
156
+ return 'hover-listener';
157
+ const title = (element.getAttribute('title') ?? '').trim();
158
+ if (title !== '' && isIconLike(element) && !titleRepeatsName(element, title))
159
+ return 'title';
160
+ return null;
161
+ }
@@ -14,12 +14,21 @@ export interface KeyboardScanOptions {
14
14
  export declare const RULE_DOCS = "https://ngbracket.com/tools/a11y-devtools/docs";
15
15
  /** A short, human CSS-ish selector for our own findings (not an axe target). */
16
16
  export declare function shortSelector(element: Element): string;
17
+ /**
18
+ * A selector that matches only `element`, for the overlay to draw the finding
19
+ * on. {@link shortSelector} can match many elements (an icon repeated in every
20
+ * table row), and the overlay would draw them all on the first. Builds an
21
+ * `:nth-child` path upward and stops as soon as it is unique, like axe's own
22
+ * targets. Undefined when the short selector is already unique, when `CSS.escape`
23
+ * is missing, or for an element in a shadow root.
24
+ */
25
+ export declare function uniqueLocator(element: Element): string | undefined;
17
26
  /** Truncated outerHTML for a finding's `html`. */
18
27
  export declare function shortHtml(element: Element): string;
19
28
  /**
20
29
  * Scan `root` for keyboard-operability problems and return them as findings.
21
- * Runs entirely in the page (needs the live `window.ng` for listeners and
22
- * attribution), so it's a no-op — empty result — in production where that global
23
- * is absent.
30
+ * Runs entirely in the page. Listener-based checks and attribution need the
31
+ * live `window.ng`, so in production only the markup-based checks (roles, tooltip
32
+ * markers, icon titles, tab order) report anything.
24
33
  */
25
34
  export declare function scanKeyboard(root?: ParentNode, options?: KeyboardScanOptions): A11yFinding[];
@@ -7,14 +7,16 @@
7
7
  * output, overlay, and report as the axe violations — attributed to the owning
8
8
  * component like everything else.
9
9
  *
10
- * Honesty guardrail: these are *heuristics*, not axe rules. `click-without-key`
11
- * and `tab-order-mismatch` are flagged as candidates to verify by hand, never as
12
- * confirmed failures.
10
+ * Honesty guardrail: these are *heuristics*, not axe rules. `click-without-key`,
11
+ * `hover-only-content` and `tab-order-mismatch` are flagged as candidates to
12
+ * verify by hand, never as confirmed failures.
13
13
  */
14
14
  import { appComponentFromPath, DEFAULT_FRAMEWORK_PREFIXES, resolveComponentPath, resolveDirectiveNames, resolveListenerEvents, ngDebug, } from '../attribution.js';
15
- import { hasFocusableDescendant, hasTabbableDescendant, isHidden, isNativelyFocusable, isTabbable, tabSequence, visualOrderJumps, } from './tab-sequence.js';
15
+ import { hasFocusableDescendant, hasTabbableDescendant, isHidden, isDisabled, isNativelyFocusable, isTabbable, tabSequence, visualOrderJumps, } from './tab-sequence.js';
16
16
  import { findUncontainedModals } from './focus-trap.js';
17
+ import { hoverSignal } from './hover-content.js';
17
18
  import { blockingModalDialog } from '../top-layer.js';
19
+ import { OVERLAY_EXCLUDE_SELECTOR } from '../overlay.js';
18
20
  /** WAI-ARIA roles that make a non-native element behave as an interactive control. */
19
21
  const INTERACTIVE_ROLES = new Set([
20
22
  'button',
@@ -208,6 +210,17 @@ function isComponentHost(el, ng) {
208
210
  return false;
209
211
  }
210
212
  }
213
+ /**
214
+ * True when an ancestor of `element` is tabbable (focus lands there, as with an
215
+ * icon inside a link) or is in `flagged` (already reported).
216
+ */
217
+ function hasTabbableOrFlaggedAncestor(element, flagged, isVisible) {
218
+ for (let el = element.parentElement; el; el = el.parentElement) {
219
+ if (flagged.has(el) || isTabbable(el, isVisible))
220
+ return true;
221
+ }
222
+ return false;
223
+ }
211
224
  const ITEM_SELECTOR = [...INTERACTIVE_ROLES].map((role) => `[role="${role}"]`).join(',');
212
225
  /**
213
226
  * True when `element` is a click-only part of something the keyboard already
@@ -250,6 +263,47 @@ export function shortSelector(element) {
250
263
  .slice(0, 2);
251
264
  return classes.length ? `${tag}.${classes.join('.')}` : tag;
252
265
  }
266
+ /**
267
+ * A selector that matches only `element`, for the overlay to draw the finding
268
+ * on. {@link shortSelector} can match many elements (an icon repeated in every
269
+ * table row), and the overlay would draw them all on the first. Builds an
270
+ * `:nth-child` path upward and stops as soon as it is unique, like axe's own
271
+ * targets. Undefined when the short selector is already unique, when `CSS.escape`
272
+ * is missing, or for an element in a shadow root.
273
+ */
274
+ export function uniqueLocator(element) {
275
+ const doc = element.ownerDocument;
276
+ const escape = globalThis.CSS?.escape;
277
+ if (!doc || typeof escape !== 'function' || element.getRootNode() !== doc)
278
+ return undefined;
279
+ const count = (selector) => {
280
+ try {
281
+ return doc.querySelectorAll(selector).length;
282
+ }
283
+ catch {
284
+ return 0;
285
+ }
286
+ };
287
+ const short = shortSelector(element);
288
+ if (count(short) === 1 && doc.querySelector(short) === element)
289
+ return undefined;
290
+ const step = (el) => {
291
+ if (el.id && count(`#${escape(el.id)}`) === 1)
292
+ return { text: `#${escape(el.id)}`, anchored: true };
293
+ const classes = [...el.classList].slice(0, 2).map((c) => `.${escape(c)}`).join('');
294
+ const index = el.parentElement ? [...el.parentElement.children].indexOf(el) + 1 : 1;
295
+ return { text: `${el.tagName.toLowerCase()}${classes}:nth-child(${index})`, anchored: false };
296
+ };
297
+ const steps = [];
298
+ for (let el = element; el && el !== doc.documentElement; el = el.parentElement) {
299
+ const { text, anchored } = step(el);
300
+ steps.unshift(text);
301
+ const selector = steps.join(' > ');
302
+ if (anchored || count(selector) === 1)
303
+ return selector;
304
+ }
305
+ return undefined;
306
+ }
253
307
  /** Truncated outerHTML for a finding's `html`. */
254
308
  export function shortHtml(element) {
255
309
  const html = element.outerHTML ?? '';
@@ -257,9 +311,9 @@ export function shortHtml(element) {
257
311
  }
258
312
  /**
259
313
  * Scan `root` for keyboard-operability problems and return them as findings.
260
- * Runs entirely in the page (needs the live `window.ng` for listeners and
261
- * attribution), so it's a no-op — empty result — in production where that global
262
- * is absent.
314
+ * Runs entirely in the page. Listener-based checks and attribution need the
315
+ * live `window.ng`, so in production only the markup-based checks (roles, tooltip
316
+ * markers, icon titles, tab order) report anything.
263
317
  */
264
318
  export function scanKeyboard(root = document, options = {}) {
265
319
  const prefixes = options.frameworkPrefixes ?? DEFAULT_FRAMEWORK_PREFIXES;
@@ -267,6 +321,49 @@ export function scanKeyboard(root = document, options = {}) {
267
321
  const findings = [];
268
322
  const keyCache = new Map();
269
323
  const sharedCache = new Map();
324
+ /** Elements reported as unreachable controls, so the hover check doesn't repeat them. */
325
+ const unreachable = new Set();
326
+ /** Angular listener names per element, read once and shared by both passes. */
327
+ const listenerEvents = new Map();
328
+ const eventsOf = (el) => {
329
+ let events = listenerEvents.get(el);
330
+ if (!events)
331
+ listenerEvents.set(el, (events = resolveListenerEvents(el)));
332
+ return events;
333
+ };
334
+ const hoverFinding = (element, signal) => {
335
+ const url = `${RULE_DOCS}/hover-only-content`;
336
+ // The disabled control itself, or a wrapper around one (Angular Material's
337
+ // documented way to give a disabled button a tooltip): a tooltip on any
338
+ // wrapper, or other hover content on a wrapper whose only child is the control.
339
+ const only = element.children.length === 1 ? element.children[0] : null;
340
+ const disabled = isNativelyFocusable(element) && isDisabled(element)
341
+ ? element
342
+ : signal === 'tooltip'
343
+ ? [...element.querySelectorAll('button, input, select, textarea')].find(isDisabled)
344
+ : only && isNativelyFocusable(only) && isDisabled(only)
345
+ ? only
346
+ : undefined;
347
+ if (disabled) {
348
+ return make(element, 'ngbr/hover-only-content', signal === 'tooltip' ? 'moderate' : 'minor', `Keyboard users may not see this disabled control's hover content: a disabled ` +
349
+ `control can't take focus, so its tooltip only opens for the mouse. Use ` +
350
+ `aria-disabled="true" instead of disabled, or show the reason as text. ` +
351
+ `Heuristic — verify manually.`, url);
352
+ }
353
+ if (signal === 'title') {
354
+ return make(element, 'ngbr/hover-only-content', 'minor', `Only mouse users see this icon's title: Tab doesn't reach the icon, so keyboard ` +
355
+ `users can't show its title. Show the text on the page, or put the icon in a ` +
356
+ `focusable control with a visible label or tooltip. Heuristic — verify manually.`, url);
357
+ }
358
+ if (signal === 'hover-listener') {
359
+ return make(element, 'ngbr/hover-only-content', 'minor', `Keyboard users may not see what this shows on hover: it listens for the mouse ` +
360
+ `moving over it, but Tab doesn't reach it. If it shows content, make it focusable ` +
361
+ `and show the content on focus too, or show it on the page. Heuristic — verify manually.`, url);
362
+ }
363
+ return make(element, 'ngbr/hover-only-content', 'moderate', `Keyboard users may not see this tooltip: it opens on hover, but Tab doesn't reach ` +
364
+ `it. Make it focusable (a <button>, or tabindex="0") and check the tooltip opens on ` +
365
+ `focus, or show the text on the page. Heuristic — verify manually.`, url);
366
+ };
270
367
  const make = (element, id, impact, help, helpUrl) => {
271
368
  const componentPath = resolveComponentPath(element);
272
369
  return {
@@ -278,6 +375,7 @@ export function scanKeyboard(root = document, options = {}) {
278
375
  componentPath,
279
376
  directives: resolveDirectiveNames(element),
280
377
  target: shortSelector(element),
378
+ locator: uniqueLocator(element),
281
379
  html: shortHtml(element),
282
380
  };
283
381
  };
@@ -293,7 +391,7 @@ export function scanKeyboard(root = document, options = {}) {
293
391
  if (isNativelyFocusable(element))
294
392
  continue;
295
393
  const role = element.getAttribute('role')?.toLowerCase() ?? '';
296
- const events = resolveListenerEvents(element);
394
+ const events = eventsOf(element);
297
395
  const hasClick = events.includes('click');
298
396
  const interactiveByRole = INTERACTIVE_ROLES.has(role);
299
397
  if (!hasClick && !interactiveByRole)
@@ -321,9 +419,11 @@ export function scanKeyboard(root = document, options = {}) {
321
419
  `out of the tab order, like a roving-tabindex item, but nothing in or around its ` +
322
420
  `widget handles keys, so arrow keys may not move to it. Handle the arrow keys, or ` +
323
421
  `use aria-activedescendant. Heuristic — verify manually.`, `${RULE_DOCS}/unreachable-control`));
422
+ unreachable.add(element);
324
423
  continue;
325
424
  }
326
425
  const reason = interactiveByRole ? `has role="${role}"` : 'has a click handler';
426
+ unreachable.add(element);
327
427
  findings.push(make(element, 'ngbr/unreachable-control', 'serious', `Keyboard users can't reach this control: it ${reason}, but it isn't a native ` +
328
428
  `control and has no tabindex="0", so Tab skips it. Use a <button> or <a href>, ` +
329
429
  `or add tabindex="0" and Enter/Space handling.`, `${RULE_DOCS}/unreachable-control`));
@@ -338,6 +438,33 @@ export function scanKeyboard(root = document, options = {}) {
338
438
  `Use a <button>, or handle Enter and Space too. Heuristic — verify manually.`, `${RULE_DOCS}/click-without-key`));
339
439
  }
340
440
  }
441
+ // Hover-only content: a tooltip, hover listener or icon `title` on something
442
+ // Tab can't reach, so keyboard users may never see what it shows.
443
+ // Seeded with the unreachable controls, so an icon inside one isn't reported again.
444
+ const hoverFlagged = new Set(unreachable);
445
+ for (const element of root.querySelectorAll('*')) {
446
+ if (modal && !modal.contains(element))
447
+ continue;
448
+ if (hoverFlagged.has(element) || element.closest(OVERLAY_EXCLUDE_SELECTOR))
449
+ continue;
450
+ const signal = hoverSignal(element, eventsOf(element));
451
+ if (!signal)
452
+ continue;
453
+ if (isTabbable(element, isVisible) || isHidden(element, isVisible))
454
+ continue;
455
+ // A wrapper around something Tab reaches: focus lands inside it. Skipped to
456
+ // keep false positives down, though the tooltip may still not open on focus.
457
+ if (hasTabbableDescendant(element, isVisible))
458
+ continue;
459
+ // Inside something Tab reaches (an icon in a link), or inside an element
460
+ // already reported: one finding is enough.
461
+ if (hasTabbableOrFlaggedAncestor(element, hoverFlagged, isVisible))
462
+ continue;
463
+ if (reachedWithinWidget(element, isVisible, keyCache, sharedCache) === 'reached')
464
+ continue;
465
+ hoverFlagged.add(element);
466
+ findings.push(hoverFinding(element, signal));
467
+ }
341
468
  // Missing focus trap (M3): an open aria-modal whose focus isn't contained.
342
469
  // Reuses the tab-order machinery (inert/hidden already excluded), so a modal
343
470
  // that correctly inerts the background is not flagged.
@@ -59,6 +59,8 @@ export declare function isNativelyFocusable(element: Element): boolean;
59
59
  * `tabindex="foo"`) is ignored by browsers, so it falls back to the native value.
60
60
  */
61
61
  export declare function resolvedTabIndex(element: Element): number;
62
+ /** True when `element` (or an ancestor) is disabled via a control or `<fieldset disabled>`. */
63
+ export declare function isDisabled(element: Element): boolean;
62
64
  /**
63
65
  * True when `element` isn't shown at all: structurally hidden (see
64
66
  * {@link isStructurallyHidden}) or hidden by layout. A hidden control is out of
@@ -122,7 +122,7 @@ export function resolvedTabIndex(element) {
122
122
  return Number.isNaN(parsed) ? nativeTabIndex(element) : parsed;
123
123
  }
124
124
  /** True when `element` (or an ancestor) is disabled via a control or `<fieldset disabled>`. */
125
- function isDisabled(element) {
125
+ export function isDisabled(element) {
126
126
  if ('disabled' in element && element.disabled)
127
127
  return true;
128
128
  // A disabled fieldset disables its controls (except those inside its first legend).
package/dist/overlay.js CHANGED
@@ -190,7 +190,7 @@ export function createOverlay(options = {}) {
190
190
  function render(findings) {
191
191
  clear();
192
192
  for (const finding of findings) {
193
- const target = resolveTarget(doc, finding.target);
193
+ const target = resolveTarget(doc, finding.locator ?? finding.target);
194
194
  if (!target)
195
195
  continue; // node gone since the scan (e.g. re-rendered)
196
196
  const box = buildBox(doc, finding);
@@ -31,7 +31,8 @@ export interface A11yDevtoolsOptions {
31
31
  /**
32
32
  * Turn on the **keyboard layer** — the ~2/3 of accessibility axe can't test.
33
33
  * Adds heuristic `ngbr/*` findings (keyboard-unreachable controls,
34
- * click-without-keyboard handlers, tab-order mismatches) to the report, and,
34
+ * click-without-keyboard handlers, hover-only content, tab-order mismatches)
35
+ * to the report, and,
35
36
  * when `overlay` is on, draws the numbered tab-order path over the page.
36
37
  * Default false.
37
38
  */
@@ -17,6 +17,7 @@ export const ACR_TITLE = 'Evaluation worksheet — not a conformance report';
17
17
  const NGBR_RULES = {
18
18
  'ngbr/unreachable-control': { criteria: ['2.1.1'], ranWhen: 'keyboard' },
19
19
  'ngbr/click-without-key': { criteria: ['2.1.1'], ranWhen: 'keyboard' },
20
+ 'ngbr/hover-only-content': { criteria: ['2.1.1'], ranWhen: 'keyboard' },
20
21
  'ngbr/tab-order-mismatch': { criteria: ['2.4.3'], ranWhen: 'keyboard' },
21
22
  'ngbr/modal-focus-not-contained': { criteria: ['2.4.3'], ranWhen: 'keyboard' },
22
23
  'ngbr/focus-trap': { criteria: ['2.1.2'], ranWhen: 'focusTraps' },
@@ -67,8 +67,8 @@ export interface ScanPagesOptions {
67
67
  frameworkPrefixes?: readonly string[];
68
68
  /**
69
69
  * Also run the keyboard layer in-page — heuristic `ngbr/*` findings for
70
- * keyboard-unreachable controls, click-without-keyboard handlers, and
71
- * tab-order mismatches (the last needs real layout, which headless has).
70
+ * keyboard-unreachable controls, click-without-keyboard handlers, hover-only
71
+ * content, and tab-order mismatches (the last needs real layout, which headless has).
72
72
  * Default false.
73
73
  */
74
74
  keyboard?: boolean;
@@ -3,6 +3,7 @@ import { createRequire } from 'node:module';
3
3
  import { dirname, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { detectTabTrap } from '../keyboard/focus-walk.js';
6
+ import { OVERLAY_EXCLUDE_SELECTOR } from '../overlay.js';
6
7
  import { findingsNotIn } from './baseline.js';
7
8
  async function loadPlaywright() {
8
9
  try {
@@ -59,6 +60,15 @@ async function walkForFocusTrap(page, frameworkPrefixes) {
59
60
  }
60
61
  /** Settle time after switching a class/attribute theme, so colour transitions finish before axe reads them. */
61
62
  const THEME_SETTLE_MS = 300;
63
+ /**
64
+ * Hides the in-app overlay (if the app runs it) for the headless scan. Its
65
+ * tab-order path is a fixed SVG that overflows the viewport, and axe's
66
+ * color-contrast counts it as covering text below the fold: that text came
67
+ * back "needs review" instead of pass/fail, so its contrast was never
68
+ * reported. Excluding the overlay from axe's context isn't enough; the exclude
69
+ * stops axe checking the overlay, not seeing it.
70
+ */
71
+ const HIDE_OVERLAY_CSS = `${OVERLAY_EXCLUDE_SELECTOR} { display: none !important; }`;
62
72
  /** Scan every route in one colour scheme, in its own browser context. */
63
73
  async function scanPass(browser, colorScheme, config) {
64
74
  const { baseUrl, routes, labels, waitMs, axeOptions, inPageScript, frameworkPrefixes } = config;
@@ -92,6 +102,7 @@ async function scanPass(browser, colorScheme, config) {
92
102
  }
93
103
  if (config.beforeScan)
94
104
  await config.beforeScan(page, { colorScheme, route });
105
+ await page.addStyleTag({ content: HIDE_OVERLAY_CSS });
95
106
  await page.addScriptTag({ content: inPageScript });
96
107
  const findings = (await page.evaluate((args) => {
97
108
  const w = window;
package/dist/runner.d.ts CHANGED
@@ -22,8 +22,8 @@ export interface RunOptions {
22
22
  frameworkPrefixes?: readonly string[];
23
23
  /**
24
24
  * Also run the keyboard layer — heuristic `ngbr/*` findings for
25
- * keyboard-unreachable controls, click-without-keyboard handlers, and
26
- * tab-order mismatches. Default false.
25
+ * keyboard-unreachable controls, click-without-keyboard handlers, hover-only
26
+ * content, and tab-order mismatches. Default false.
27
27
  */
28
28
  keyboard?: boolean;
29
29
  }
package/dist/scan.d.ts CHANGED
@@ -32,6 +32,12 @@ export interface A11yFinding {
32
32
  directives: string[];
33
33
  /** CSS selector axe reported for the node. */
34
34
  target: string;
35
+ /**
36
+ * A selector that matches only this node, when `target` can match others.
37
+ * Set by the keyboard layer; the overlay uses it to find the node. Not part of
38
+ * a finding's identity in a baseline.
39
+ */
40
+ locator?: string;
35
41
  html: string;
36
42
  }
37
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngbracket/a11y-devtools",
3
- "version": "0.15.7",
3
+ "version": "0.16.0",
4
4
  "description": "Finds accessibility problems in Angular apps and names the component behind each one. A dev overlay, or headless reports for CI.",
5
5
  "license": "MIT",
6
6
  "author": "Duncan Faulkner",
@@ -71,15 +71,15 @@
71
71
  "devDependencies": {
72
72
  "esbuild": "^0.28.2",
73
73
  "playwright": "^1.40.0",
74
- "@analogjs/vite-plugin-angular": "^2.7.2",
75
- "@analogjs/vitest-angular": "^2.7.2",
76
- "@angular/build": "^22.1.7",
77
- "@angular/common": "^22.1.5",
78
- "@angular/compiler": "^22.1.5",
79
- "@angular/compiler-cli": "^22.1.5",
80
- "@angular/core": "^22.1.5",
81
- "@angular/platform-browser": "^22.1.5",
82
- "@angular/platform-browser-dynamic": "^22.1.5",
74
+ "@analogjs/vite-plugin-angular": "^2.8.0",
75
+ "@analogjs/vitest-angular": "^2.8.0",
76
+ "@angular/build": "^22.2.1",
77
+ "@angular/common": "^22.2.1",
78
+ "@angular/compiler": "^22.2.1",
79
+ "@angular/compiler-cli": "^22.2.1",
80
+ "@angular/core": "^22.2.1",
81
+ "@angular/platform-browser": "^22.2.1",
82
+ "@angular/platform-browser-dynamic": "^22.2.1",
83
83
  "@oxc-project/runtime": "^0.149.0",
84
84
  "@types/node": "^26.5.0",
85
85
  "jsdom": "^30.0.1",