@ngbracket/a11y-devtools 0.15.2 → 0.15.3
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 +14 -0
- package/dist/inpage.global.js +16 -0
- package/dist/keyboard/keyboard-scan.js +26 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.15.3
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- **`ngbr/unreachable-control` no longer flags mouse shortcuts inside a
|
|
11
|
+
keyboard-operated widget.** A click-only element with no role of its own is
|
|
12
|
+
skipped when it's part of something the keyboard already operates: a
|
|
13
|
+
composite-widget item Tab or arrow keys reach (a tree's expand/collapse arrow
|
|
14
|
+
inside its treeitem, which ←/→ expand), or the nearest Tab-reachable ancestor
|
|
15
|
+
that handles keys itself (the bars, slices and points of a focusable chart
|
|
16
|
+
that moves between them with arrow keys). A page-wide key listener doesn't
|
|
17
|
+
count, and a click target inside a focusable ancestor with no key handling is
|
|
18
|
+
still reported. Found on our own docs (dev build): 83 false positives → 0.
|
|
19
|
+
|
|
6
20
|
## 0.15.2
|
|
7
21
|
|
|
8
22
|
### Fixed
|
package/dist/inpage.global.js
CHANGED
|
@@ -34847,6 +34847,20 @@
|
|
|
34847
34847
|
return false;
|
|
34848
34848
|
return isTabbable(widget, isVisible) || controllers.length > 0 || hasTabbableDescendant(widget, isVisible);
|
|
34849
34849
|
}
|
|
34850
|
+
var ITEM_SELECTOR = [...INTERACTIVE_ROLES].map((role) => `[role="${role}"]`).join(",");
|
|
34851
|
+
function partOfKeyboardOperatedWidget(element, isVisible) {
|
|
34852
|
+
const item = element.parentElement?.closest(ITEM_SELECTOR);
|
|
34853
|
+
if (item?.parentElement?.closest(COMPOSITE_SELECTOR)) {
|
|
34854
|
+
if (isTabbable(item, isVisible) || reachedWithinWidget(item, isVisible))
|
|
34855
|
+
return true;
|
|
34856
|
+
}
|
|
34857
|
+
for (let el = element.parentElement; el; el = el.parentElement) {
|
|
34858
|
+
if (!isTabbable(el, isVisible))
|
|
34859
|
+
continue;
|
|
34860
|
+
return resolveListenerEvents(el).some((e) => KEY_EVENTS.includes(e));
|
|
34861
|
+
}
|
|
34862
|
+
return false;
|
|
34863
|
+
}
|
|
34850
34864
|
var RULE_DOCS = "https://ngbracket.com/tools/a11y-devtools/docs";
|
|
34851
34865
|
function shortSelector(element) {
|
|
34852
34866
|
const tag = element.tagName.toLowerCase();
|
|
@@ -34894,6 +34908,8 @@
|
|
|
34894
34908
|
continue;
|
|
34895
34909
|
if (isHidden(element, isVisible))
|
|
34896
34910
|
continue;
|
|
34911
|
+
if (!interactiveByRole && partOfKeyboardOperatedWidget(element, isVisible))
|
|
34912
|
+
continue;
|
|
34897
34913
|
const focusable = isTabbable(element, isVisible);
|
|
34898
34914
|
if (!focusable) {
|
|
34899
34915
|
if (interactiveByRole && reachedWithinWidget(element, isVisible))
|
|
@@ -69,6 +69,30 @@ function reachedWithinWidget(element, isVisible) {
|
|
|
69
69
|
return false;
|
|
70
70
|
return isTabbable(widget, isVisible) || controllers.length > 0 || hasTabbableDescendant(widget, isVisible);
|
|
71
71
|
}
|
|
72
|
+
const ITEM_SELECTOR = [...INTERACTIVE_ROLES].map((role) => `[role="${role}"]`).join(',');
|
|
73
|
+
/**
|
|
74
|
+
* True when `element` is a click-only part of something the keyboard already
|
|
75
|
+
* operates, so the click is a mouse shortcut, not a control of its own:
|
|
76
|
+
* - a composite-widget item that the keyboard can reach, such as a tree's
|
|
77
|
+
* expand/collapse arrow inside its treeitem (←/→ on the treeitem); or
|
|
78
|
+
* - the nearest Tab-reachable ancestor that handles keys itself, such as a
|
|
79
|
+
* chart's bars inside a focusable chart that moves between them with arrow
|
|
80
|
+
* keys. `<body>` is never tabbable, so a page-wide shortcut listener doesn't
|
|
81
|
+
* count.
|
|
82
|
+
*/
|
|
83
|
+
function partOfKeyboardOperatedWidget(element, isVisible) {
|
|
84
|
+
const item = element.parentElement?.closest(ITEM_SELECTOR);
|
|
85
|
+
if (item?.parentElement?.closest(COMPOSITE_SELECTOR)) {
|
|
86
|
+
if (isTabbable(item, isVisible) || reachedWithinWidget(item, isVisible))
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
for (let el = element.parentElement; el; el = el.parentElement) {
|
|
90
|
+
if (!isTabbable(el, isVisible))
|
|
91
|
+
continue;
|
|
92
|
+
return resolveListenerEvents(el).some((e) => KEY_EVENTS.includes(e));
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
72
96
|
/**
|
|
73
97
|
* Each rule's page: what the message means, who it affects, exactly what
|
|
74
98
|
* triggers it, how to fix and check it, and the WCAG/APG reference.
|
|
@@ -141,6 +165,8 @@ export function scanKeyboard(root = document, options = {}) {
|
|
|
141
165
|
// it isn't shown. Check it when it is.
|
|
142
166
|
if (isHidden(element, isVisible))
|
|
143
167
|
continue;
|
|
168
|
+
if (!interactiveByRole && partOfKeyboardOperatedWidget(element, isVisible))
|
|
169
|
+
continue;
|
|
144
170
|
const focusable = isTabbable(element, isVisible);
|
|
145
171
|
if (!focusable) {
|
|
146
172
|
if (interactiveByRole && reachedWithinWidget(element, isVisible))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngbracket/a11y-devtools",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "Dev-only in-app accessibility auditing for Angular that maps each axe violation back to the component that rendered it — the attribution React overlay tools can't do.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Duncan Faulkner",
|