@ngbracket/a11y-devtools 0.18.3 → 0.18.5

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,38 @@
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.18.5
7
+
8
+ ### Fixed
9
+
10
+ - The dashed line joining the tab-order badges is drawn opaque. At 70% opacity
11
+ the teal blended to about 2.5:1 on a white page, under the 3:1 that WCAG
12
+ 1.4.11 asks of non-text content. Opaque, it measures 3.93:1 on white, 3.61:1
13
+ on #f5f5f5, 3.5:1 on #2d2d2d and 5.34:1 on black. On a mid-tone page it can
14
+ still fall under 3:1.
15
+ - The tab-order layer is clipped to the viewport. When the path ran past the
16
+ bottom of the window, axe's color-contrast check treated it as covering the
17
+ text below the fold and returned "needs review" for that text. A
18
+ low-contrast paragraph under the path was not reported as a violation.
19
+ Report mode already hid the overlay before scanning and still does, because
20
+ the app it scans may run an older overlay.
21
+ - The on/off pill and its menu now sit in a region labelled "Accessibility
22
+ developer tools". A page scan that doesn't exclude the overlay, such as an
23
+ axe browser extension, reported the pill under the best-practice `region`
24
+ rule as content outside any landmark.
25
+
26
+ ## 0.18.4
27
+
28
+ ### Fixed
29
+
30
+ - Clicks now reach a flagged element while the overlay is on. Each highlight
31
+ box took clicks, so a flagged button couldn't be pressed, and a flagged
32
+ dialog (for example one with no accessible name) was covered completely: its
33
+ close button and every other control inside it stopped working, and the page
34
+ had to be reloaded unless Escape closed the dialog. The box now lets clicks
35
+ through. Only the small label above the box still takes clicks, and clicking
36
+ it scrolls to the element as before.
37
+
6
38
  ## 0.18.3
7
39
 
8
40
  ### Fixed
@@ -34337,7 +34337,7 @@
34337
34337
  position: "fixed",
34338
34338
  inset: "0",
34339
34339
  pointerEvents: "none",
34340
- // pass clicks through; individual boxes opt back in
34340
+ // pass clicks through; finding labels opt back in
34341
34341
  zIndex: "2147483646"
34342
34342
  });
34343
34343
  doc.body.appendChild(container);
@@ -34350,14 +34350,13 @@
34350
34350
  width: "100%",
34351
34351
  height: "100%",
34352
34352
  pointerEvents: "none",
34353
- overflow: "visible"
34353
+ overflow: "hidden"
34354
34354
  });
34355
34355
  const connector = doc.createElementNS(SVG_NS, "polyline");
34356
34356
  connector.setAttribute("fill", "none");
34357
34357
  connector.setAttribute("stroke", TAB_ORDER_COLOR);
34358
34358
  connector.setAttribute("stroke-width", "2");
34359
34359
  connector.setAttribute("stroke-dasharray", "4 3");
34360
- connector.setAttribute("opacity", "0.7");
34361
34360
  svg.appendChild(connector);
34362
34361
  container.appendChild(svg);
34363
34362
  const axPanel = doc.createElement("div");
@@ -34445,8 +34444,7 @@
34445
34444
  const target = resolveTarget(doc, finding.locator ?? finding.target);
34446
34445
  if (!target)
34447
34446
  continue;
34448
- const box = buildBox(doc, finding);
34449
- box.addEventListener("click", () => flashAndScroll(target, box));
34447
+ const box = buildBox(doc, finding, () => flashAndScroll(target, box));
34450
34448
  container.appendChild(box);
34451
34449
  positionBox(box, target);
34452
34450
  highlights.push({ finding, target, box });
@@ -34560,11 +34558,10 @@
34560
34558
  return null;
34561
34559
  }
34562
34560
  }
34563
- function buildBox(doc, finding) {
34561
+ function buildBox(doc, finding, onLabelClick) {
34564
34562
  const color = colorFor(finding.impact);
34565
34563
  const box = doc.createElement("div");
34566
34564
  box.setAttribute("data-impact", finding.impact ?? "none");
34567
- box.title = `${finding.id}: ${finding.help}`;
34568
34565
  Object.assign(box.style, {
34569
34566
  position: "fixed",
34570
34567
  boxSizing: "border-box",
@@ -34572,10 +34569,11 @@
34572
34569
  borderRadius: "2px",
34573
34570
  background: `${color}1a`,
34574
34571
  // ~10% alpha
34575
- pointerEvents: "auto",
34576
- cursor: "pointer"
34572
+ pointerEvents: "none"
34577
34573
  });
34578
34574
  const label = doc.createElement("span");
34575
+ label.title = `${finding.id}: ${finding.help}`;
34576
+ label.addEventListener("click", onLabelClick);
34579
34577
  label.textContent = finding.component ? `${finding.component} \xB7 ${finding.id}` : finding.id;
34580
34578
  Object.assign(label.style, {
34581
34579
  position: "absolute",
@@ -34586,7 +34584,9 @@
34586
34584
  font: "11px/1.4 ui-monospace, monospace",
34587
34585
  color: "#fff",
34588
34586
  background: IMPACT_LABEL_FILL[finding.impact ?? "none"],
34589
- whiteSpace: "nowrap"
34587
+ whiteSpace: "nowrap",
34588
+ pointerEvents: "auto",
34589
+ cursor: "pointer"
34590
34590
  });
34591
34591
  box.appendChild(label);
34592
34592
  return box;
package/dist/overlay.js CHANGED
@@ -63,7 +63,7 @@ export function createOverlay(options = {}) {
63
63
  Object.assign(container.style, {
64
64
  position: 'fixed',
65
65
  inset: '0',
66
- pointerEvents: 'none', // pass clicks through; individual boxes opt back in
66
+ pointerEvents: 'none', // pass clicks through; finding labels opt back in
67
67
  zIndex: '2147483646',
68
68
  });
69
69
  doc.body.appendChild(container);
@@ -72,6 +72,8 @@ export function createOverlay(options = {}) {
72
72
  const releaseTopLayer = keepInTopLayer(container, { document: doc });
73
73
  // The tab-order connector lives on its own SVG layer under the badges, so the
74
74
  // findings highlights and the tab-order path render and clear independently.
75
+ // Clipped to the viewport: a path left to overflow it covers text below the
76
+ // fold, and axe's color-contrast then gives up on that text ("needs review").
75
77
  const svg = doc.createElementNS(SVG_NS, 'svg');
76
78
  svg.setAttribute(OVERLAY_ATTR, '');
77
79
  Object.assign(svg.style, {
@@ -80,14 +82,16 @@ export function createOverlay(options = {}) {
80
82
  width: '100%',
81
83
  height: '100%',
82
84
  pointerEvents: 'none',
83
- overflow: 'visible',
85
+ overflow: 'hidden',
84
86
  });
87
+ // Drawn opaque so the line passes 3:1 for non-text contrast: the teal is
88
+ // 3.93:1 on white, 3.61:1 on #f5f5f5, 3.5:1 on #2d2d2d and 5.34:1 on black.
89
+ // At 0.7 opacity it blended to about 2.5:1 on white.
85
90
  const connector = doc.createElementNS(SVG_NS, 'polyline');
86
91
  connector.setAttribute('fill', 'none');
87
92
  connector.setAttribute('stroke', TAB_ORDER_COLOR);
88
93
  connector.setAttribute('stroke-width', '2');
89
94
  connector.setAttribute('stroke-dasharray', '4 3');
90
- connector.setAttribute('opacity', '0.7');
91
95
  svg.appendChild(connector);
92
96
  container.appendChild(svg); // under the badges, which are appended later
93
97
  // The Focus preview panel: a fixed card that follows focus. Hidden
@@ -193,8 +197,7 @@ export function createOverlay(options = {}) {
193
197
  const target = resolveTarget(doc, finding.locator ?? finding.target);
194
198
  if (!target)
195
199
  continue; // node gone since the scan (e.g. re-rendered)
196
- const box = buildBox(doc, finding);
197
- box.addEventListener('click', () => flashAndScroll(target, box));
200
+ const box = buildBox(doc, finding, () => flashAndScroll(target, box));
198
201
  container.appendChild(box);
199
202
  positionBox(box, target);
200
203
  highlights.push({ finding, target, box });
@@ -318,21 +321,25 @@ function resolveTarget(doc, target) {
318
321
  return null;
319
322
  }
320
323
  }
321
- function buildBox(doc, finding) {
324
+ /**
325
+ * The box lets clicks through to the flagged element, so a flagged button or a
326
+ * whole flagged dialog stays usable. Only the label takes clicks.
327
+ */
328
+ function buildBox(doc, finding, onLabelClick) {
322
329
  const color = colorFor(finding.impact);
323
330
  const box = doc.createElement('div');
324
331
  box.setAttribute('data-impact', finding.impact ?? 'none');
325
- box.title = `${finding.id}: ${finding.help}`;
326
332
  Object.assign(box.style, {
327
333
  position: 'fixed',
328
334
  boxSizing: 'border-box',
329
335
  border: `2px solid ${color}`,
330
336
  borderRadius: '2px',
331
337
  background: `${color}1a`, // ~10% alpha
332
- pointerEvents: 'auto',
333
- cursor: 'pointer',
338
+ pointerEvents: 'none',
334
339
  });
335
340
  const label = doc.createElement('span');
341
+ label.title = `${finding.id}: ${finding.help}`;
342
+ label.addEventListener('click', onLabelClick);
336
343
  label.textContent = finding.component
337
344
  ? `${finding.component} · ${finding.id}`
338
345
  : finding.id;
@@ -346,6 +353,8 @@ function buildBox(doc, finding) {
346
353
  color: '#fff',
347
354
  background: IMPACT_LABEL_FILL[finding.impact ?? 'none'],
348
355
  whiteSpace: 'nowrap',
356
+ pointerEvents: 'auto',
357
+ cursor: 'pointer',
349
358
  });
350
359
  box.appendChild(label);
351
360
  return box;
@@ -61,12 +61,14 @@ async function walkForFocusTrap(page, frameworkPrefixes) {
61
61
  /** Settle time after switching a class/attribute theme, so colour transitions finish before axe reads them. */
62
62
  const THEME_SETTLE_MS = 300;
63
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.
64
+ * Hides the in-app overlay (if the app runs it) for the headless scan. Up to
65
+ * 0.18.4 its tab-order path was a fixed SVG that overflowed the viewport, and
66
+ * axe's color-contrast counted it as covering text below the fold: that text
67
+ * came back "needs review" instead of pass/fail, so its contrast was never
68
+ * reported. The SVG is clipped to the viewport since 0.18.5, but the app being
69
+ * scanned may run an older overlay than this report, so the hide stays.
70
+ * Excluding the overlay from axe's context isn't enough; the exclude stops axe
71
+ * checking the overlay, not seeing it.
70
72
  */
71
73
  const HIDE_OVERLAY_CSS = `${OVERLAY_EXCLUDE_SELECTOR} { display: none !important; }`;
72
74
  /** Scan every route in one colour scheme, in its own browser context. */
package/dist/toggle.js CHANGED
@@ -214,8 +214,13 @@ export function createTogglePill(options) {
214
214
  pointerEvents: 'none',
215
215
  zIndex: '2147483647',
216
216
  });
217
- // The switch, the optional menu button and its panel sit together in a corner.
217
+ // The switch, the optional menu button and its panel sit together in a corner,
218
+ // in a labelled region so a page scan doesn't report the pill as content
219
+ // outside any landmark (axe's `region` rule). The region's name differs from
220
+ // the switch's, so tabbing in doesn't announce "a11y devtools" twice.
218
221
  const group = doc.createElement('div');
222
+ group.setAttribute('role', 'region');
223
+ group.setAttribute('aria-label', 'Accessibility developer tools');
219
224
  Object.assign(group.style, {
220
225
  position: 'fixed',
221
226
  [vertical]: '12px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngbracket/a11y-devtools",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
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",
@@ -90,6 +90,9 @@
90
90
  "rxjs": "^7.8.2",
91
91
  "tslib": "^2.8.1",
92
92
  "typescript": "^6.0.3",
93
- "vitest": "^4.1.11"
93
+ "vitest": "^4.1.12"
94
+ },
95
+ "overrides": {
96
+ "vite": "^8.3.5"
94
97
  }
95
98
  }