@a11y-oracle/focus-analyzer 1.1.3 → 1.2.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/README.md +2 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -59,12 +59,12 @@ Extracts computed CSS properties (`outline`, `box-shadow`, `border-color`, `back
|
|
|
59
59
|
Returns a default "not visible" indicator if no element has focus.
|
|
60
60
|
|
|
61
61
|
**Visibility detection:**
|
|
62
|
-
- An element has a visible **outline** if `outline-width` is not `0px` and
|
|
62
|
+
- An element has a visible **outline** if `outline-width` is not `0px` and the outline color has a non-zero alpha channel (detects both the `transparent` keyword and `rgba(0, 0, 0, 0)` which Chrome reports for transparent outlines)
|
|
63
63
|
- An element has a visible **box-shadow** if `box-shadow` is not `none`
|
|
64
64
|
|
|
65
65
|
**Contrast calculation:**
|
|
66
66
|
- For outlines: contrast ratio between `outline-color` and `background-color`
|
|
67
|
-
- For box-shadows: extracts
|
|
67
|
+
- For box-shadows: extracts all colors from the `box-shadow` value, filters out transparent ones, and uses the **outermost visible color** (last non-transparent) for contrast calculation. This correctly handles Tailwind CSS multi-ring patterns where the decorative spacer ring appears first and the actual focus indicator ring appears last.
|
|
68
68
|
- Returns `contrastRatio: null` if colors cannot be reliably parsed (e.g., gradients, complex color functions)
|
|
69
69
|
|
|
70
70
|
**WCAG 2.4.12 AA compliance:** `meetsWCAG_AA` is `true` when the indicator is visible AND the contrast ratio >= 3.0.
|
|
@@ -199,6 +199,5 @@ export type { RGBColor, FocusIndicator, TabOrderEntry, TraversalResult, TabOrder
|
|
|
199
199
|
## Limitations
|
|
200
200
|
|
|
201
201
|
- **Complex focus indicators** — Gradients, CSS `color-mix()`, and other advanced color functions return `contrastRatio: null` because they cannot be reliably parsed into a single color value.
|
|
202
|
-
- **Box-shadow parsing** — Only the first color found in a `box-shadow` value is used for contrast calculation. Multi-layer box-shadows may not be fully analyzed.
|
|
203
202
|
- **Keyboard trap detection** — Tests with Tab key only. Intentional focus traps (e.g., modal dialogs) should be tested separately with Escape key navigation.
|
|
204
203
|
- **`tabIndex` ordering** — The tab order extraction follows the standard algorithm (positive `tabIndex` first, then `tabIndex=0` in DOM order), but doesn't account for Shadow DOM boundaries.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a11y-oracle/focus-analyzer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Focus indicator CSS analysis (WCAG 2.4.12), tab order extraction, and keyboard trap detection",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "a11y-oracle",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"!**/*.tsbuildinfo"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@a11y-oracle/cdp-types": "1.
|
|
46
|
-
"@a11y-oracle/keyboard-engine": "1.
|
|
45
|
+
"@a11y-oracle/cdp-types": "1.2.0",
|
|
46
|
+
"@a11y-oracle/keyboard-engine": "1.2.0",
|
|
47
47
|
"tslib": "^2.3.0"
|
|
48
48
|
}
|
|
49
49
|
}
|