@ngbracket/a11y-devtools 0.18.3 → 0.18.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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.4
7
+
8
+ ### Fixed
9
+
10
+ - Clicks now reach a flagged element while the overlay is on. Each highlight
11
+ box took clicks, so a flagged button couldn't be pressed, and a flagged
12
+ dialog (for example one with no accessible name) was covered completely: its
13
+ close button and every other control inside it stopped working, and the page
14
+ had to be reloaded unless Escape closed the dialog. The box now lets clicks
15
+ through. Only the small label above the box still takes clicks, and clicking
16
+ it scrolls to the element as before.
17
+
6
18
  ## 0.18.3
7
19
 
8
20
  ### 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);
@@ -34445,8 +34445,7 @@
34445
34445
  const target = resolveTarget(doc, finding.locator ?? finding.target);
34446
34446
  if (!target)
34447
34447
  continue;
34448
- const box = buildBox(doc, finding);
34449
- box.addEventListener("click", () => flashAndScroll(target, box));
34448
+ const box = buildBox(doc, finding, () => flashAndScroll(target, box));
34450
34449
  container.appendChild(box);
34451
34450
  positionBox(box, target);
34452
34451
  highlights.push({ finding, target, box });
@@ -34560,11 +34559,10 @@
34560
34559
  return null;
34561
34560
  }
34562
34561
  }
34563
- function buildBox(doc, finding) {
34562
+ function buildBox(doc, finding, onLabelClick) {
34564
34563
  const color = colorFor(finding.impact);
34565
34564
  const box = doc.createElement("div");
34566
34565
  box.setAttribute("data-impact", finding.impact ?? "none");
34567
- box.title = `${finding.id}: ${finding.help}`;
34568
34566
  Object.assign(box.style, {
34569
34567
  position: "fixed",
34570
34568
  boxSizing: "border-box",
@@ -34572,10 +34570,11 @@
34572
34570
  borderRadius: "2px",
34573
34571
  background: `${color}1a`,
34574
34572
  // ~10% alpha
34575
- pointerEvents: "auto",
34576
- cursor: "pointer"
34573
+ pointerEvents: "none"
34577
34574
  });
34578
34575
  const label = doc.createElement("span");
34576
+ label.title = `${finding.id}: ${finding.help}`;
34577
+ label.addEventListener("click", onLabelClick);
34579
34578
  label.textContent = finding.component ? `${finding.component} \xB7 ${finding.id}` : finding.id;
34580
34579
  Object.assign(label.style, {
34581
34580
  position: "absolute",
@@ -34586,7 +34585,9 @@
34586
34585
  font: "11px/1.4 ui-monospace, monospace",
34587
34586
  color: "#fff",
34588
34587
  background: IMPACT_LABEL_FILL[finding.impact ?? "none"],
34589
- whiteSpace: "nowrap"
34588
+ whiteSpace: "nowrap",
34589
+ pointerEvents: "auto",
34590
+ cursor: "pointer"
34590
34591
  });
34591
34592
  box.appendChild(label);
34592
34593
  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);
@@ -193,8 +193,7 @@ export function createOverlay(options = {}) {
193
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
- const box = buildBox(doc, finding);
197
- box.addEventListener('click', () => flashAndScroll(target, box));
196
+ const box = buildBox(doc, finding, () => flashAndScroll(target, box));
198
197
  container.appendChild(box);
199
198
  positionBox(box, target);
200
199
  highlights.push({ finding, target, box });
@@ -318,21 +317,25 @@ function resolveTarget(doc, target) {
318
317
  return null;
319
318
  }
320
319
  }
321
- function buildBox(doc, finding) {
320
+ /**
321
+ * The box lets clicks through to the flagged element, so a flagged button or a
322
+ * whole flagged dialog stays usable. Only the label takes clicks.
323
+ */
324
+ function buildBox(doc, finding, onLabelClick) {
322
325
  const color = colorFor(finding.impact);
323
326
  const box = doc.createElement('div');
324
327
  box.setAttribute('data-impact', finding.impact ?? 'none');
325
- box.title = `${finding.id}: ${finding.help}`;
326
328
  Object.assign(box.style, {
327
329
  position: 'fixed',
328
330
  boxSizing: 'border-box',
329
331
  border: `2px solid ${color}`,
330
332
  borderRadius: '2px',
331
333
  background: `${color}1a`, // ~10% alpha
332
- pointerEvents: 'auto',
333
- cursor: 'pointer',
334
+ pointerEvents: 'none',
334
335
  });
335
336
  const label = doc.createElement('span');
337
+ label.title = `${finding.id}: ${finding.help}`;
338
+ label.addEventListener('click', onLabelClick);
336
339
  label.textContent = finding.component
337
340
  ? `${finding.component} · ${finding.id}`
338
341
  : finding.id;
@@ -346,6 +349,8 @@ function buildBox(doc, finding) {
346
349
  color: '#fff',
347
350
  background: IMPACT_LABEL_FILL[finding.impact ?? 'none'],
348
351
  whiteSpace: 'nowrap',
352
+ pointerEvents: 'auto',
353
+ cursor: 'pointer',
349
354
  });
350
355
  box.appendChild(label);
351
356
  return box;
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.4",
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",