You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/a11y-debugging/SKILL.md
+21-35Lines changed: 21 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ description: Uses Chrome DevTools MCP for accessibility (a11y) debugging and aud
7
7
8
8
**Accessibility Tree vs DOM**: Visually hiding an element (e.g., `CSS opacity: 0`) behaves differently for screen readers than `display: none` or `aria-hidden="true"`. The `take_snapshot` tool returns the accessibility tree of the page, which represents what assistive technologies "see", making it the most reliable source of truth for semantic structure.
9
9
10
-
**Reading web.dev documentation**: If you need to research specific accessibility guidelines (like `https://web.dev/articles/accessible-tap-targets`), you can append `.md.txt` to the URL (e.g., `https://web.dev/articles/accessible-tap-targets.md.txt`) to fetch the clean, raw markdown version. This is much easier to read using the `read_url_content` tool!
10
+
**Reading web.dev documentation**: If you need to research specific accessibility guidelines (like `https://web.dev/articles/accessible-tap-targets`), you can append `.md.txt` to the URL (e.g., `https://web.dev/articles/accessible-tap-targets.md.txt`) to fetch the clean, raw markdown version. This is much easier to read!
11
11
12
12
## Workflow Patterns
13
13
@@ -34,26 +34,21 @@ The accessibility tree exposes the heading hierarchy and semantic landmarks.
34
34
1. Locate buttons, inputs, and images in the `take_snapshot` output.
35
35
2. Ensure interactive elements have an accessible name (e.g., a button should not just say `""` if it only contains an icon).
36
36
3.**Orphaned Inputs**: Verify that all form inputs have associated labels. Use `evaluate_script` to check for inputs missing `id` (for `label[for]`) or `aria-label`:
@@ -73,15 +68,15 @@ Testing "keyboard traps" and proper focus management without visual feedback rel
73
68
74
69
According to web.dev, tap targets should be at least 48x48 pixels with sufficient spacing. Since the accessibility tree doesn't show sizes, use `evaluate_script`:
75
70
76
-
```javascript
71
+
```js
77
72
// Usage in console: copy, paste, and call with element: fn(element)
78
73
el => {
79
74
const rect = el.getBoundingClientRect();
80
75
return {width: rect.width, height: rect.height};
81
76
};
82
77
````
83
78
84
-
_Pass the element's `uid` from the snapshot as an argument to the tool._
79
+
_Pass the element's `uid` from the snapshot as an argument to `evaluate_script`._
85
80
86
81
### 6. Color Contrast
87
82
@@ -94,7 +89,7 @@ If native audits do not report issues (which may happen in some headless environ
94
89
95
90
**Note**: This script uses a simplified algorithm and may not account for transparency, gradients, or background images. For production-grade auditing, consider injecting `axe-core`.
96
91
97
-
```javascript
92
+
```js
98
93
el => {
99
94
function getRGB(colorStr) {
100
95
const match = colorStr.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
@@ -133,28 +128,19 @@ _Pass the element's `uid` to test the contrast against WCAG AA (4.5:1 for normal
133
128
134
129
Verify document-level accessibility settings often missed in component testing:
135
130
136
-
```javascript
137
-
(() => {
138
-
const f = () => {
139
-
return {
140
-
lang:
141
-
document.documentElement.lang ||
142
-
'MISSING- Screen readers need thisfor pronunciation',
143
-
title: document.title || 'MISSING- Required for context',
0 commit comments