chill-agent 1.2.0 → 1.3.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/GUIDE.md +47 -0
- package/INSTALL.md +78 -0
- package/after-install.md +23 -0
- package/antislop.md +764 -0
- package/chillslop.md +764 -0
- package/commands/chill-audit.toml +2 -0
- package/commands/chill-debt.toml +2 -0
- package/commands/chill-gain.toml +2 -0
- package/commands/chill-help.toml +2 -0
- package/commands/chill-review.toml +2 -0
- package/commands/chill.toml +2 -0
- package/docs/agent-portability.md +62 -0
- package/docs/cursor-hooks.md +200 -0
- package/gemini-extension.json +6 -0
- package/opencode.json +18 -0
- package/package.json +17 -2
- package/plugin.json +3 -0
- package/plugin.yaml +12 -0
- package/rules/antislop.md +764 -0
- package/rules/chillslop.md +764 -0
- package/rules/chillslop.mdc +764 -0
- package/skills/chill-audit/SKILL.md +103 -0
- package/skills/chill-debt/SKILL.md +44 -0
- package/skills/chill-gain/SKILL.md +52 -0
- package/skills/chill-help/SKILL.md +76 -0
- package/skills/chill-review/SKILL.md +101 -0
- package/skills/chill-slop/VERSION +1 -0
- package/skills/chill-slop-human/contrast-check.py +168 -0
- package/skills/chill-slop-human/contrast-mcp.py +121 -0
- package/skills/chill-slop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/chill-slop-human/references/WCAG.md +127 -0
- package/skills/chill-slop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/chill-slop-ui/references/WEB-BASELINE.md +28 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Accessibility Code Patterns
|
|
2
|
+
|
|
3
|
+
> Reference for antislop. Adapted from the MIT-licensed web-quality-skills by Addy Osmani (https://github.com/addyosmani/web-quality-skills); see LICENSE-web-quality-skills in the skill folder.
|
|
4
|
+
|
|
5
|
+
Practical, copy-paste-ready patterns for common accessibility requirements. Each pattern is self-contained and linked from the main [SKILL.md](../SKILL.md).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Pointer cursor base layer
|
|
10
|
+
|
|
11
|
+
Set once, in the base CSS layer, so no component has to remember it (R-39). A CSS reset such as Tailwind preflight sets `button` to `cursor: default`, so this layer comes after the reset.
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
a[href], button, summary, select, label[for],
|
|
15
|
+
label:has(> input[type="checkbox"], > input[type="radio"]),
|
|
16
|
+
[role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"],
|
|
17
|
+
input[type="checkbox"], input[type="radio"], input[type="file"],
|
|
18
|
+
input[type="submit"], input[type="button"], input[type="reset"], input[type="range"], input[type="color"] {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
:disabled, [aria-disabled="true"] { cursor: not-allowed; }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Text inputs keep `cursor: text`, and drag handles use `grab` / `grabbing`. An implicit label that wraps a checkbox or radio is included, since clicking it toggles the control.
|
|
25
|
+
|
|
26
|
+
## Modal focus trap
|
|
27
|
+
|
|
28
|
+
Trap keyboard focus inside a modal dialog so Tab/Shift+Tab cycle through its focusable elements and Escape closes it.
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
function trapFocus(modal, onClose) {
|
|
32
|
+
const focusable = modal.querySelectorAll(
|
|
33
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
34
|
+
);
|
|
35
|
+
if (focusable.length === 0) return () => {};
|
|
36
|
+
|
|
37
|
+
const first = focusable[0];
|
|
38
|
+
const last = focusable[focusable.length - 1];
|
|
39
|
+
|
|
40
|
+
function onKeydown(e) {
|
|
41
|
+
if (e.key === 'Escape') return onClose();
|
|
42
|
+
if (e.key !== 'Tab') return;
|
|
43
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
last.focus();
|
|
46
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
first.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
modal.addEventListener('keydown', onKeydown);
|
|
53
|
+
first.focus();
|
|
54
|
+
return () => modal.removeEventListener('keydown', onKeydown);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Call the returned function when the dialog closes, or a second open stacks a second listener:
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
const release = trapFocus(dialog, () => dialog.close());
|
|
62
|
+
dialog.addEventListener('close', release, { once: true });
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The native `<dialog>` element handles focus trapping automatically, prefer it when browser support allows.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Skip link
|
|
70
|
+
|
|
71
|
+
Allows keyboard users to bypass repetitive navigation and jump straight to main content.
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<body>
|
|
75
|
+
<a href="#main-content" class="skip-link">Skip to main content</a>
|
|
76
|
+
<header><!-- navigation --></header>
|
|
77
|
+
<main id="main-content" tabindex="-1">
|
|
78
|
+
<!-- main content -->
|
|
79
|
+
</main>
|
|
80
|
+
</body>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
.skip-link {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: -40px;
|
|
87
|
+
left: 0;
|
|
88
|
+
background: #000;
|
|
89
|
+
color: #fff;
|
|
90
|
+
padding: 8px 16px;
|
|
91
|
+
z-index: 100;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.skip-link:focus {
|
|
95
|
+
top: 0;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Error handling
|
|
102
|
+
|
|
103
|
+
Announce errors to screen readers and focus the first invalid field on submit.
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<form novalidate>
|
|
107
|
+
<div id="error-summary" tabindex="-1" hidden></div>
|
|
108
|
+
<div class="field" aria-live="polite">
|
|
109
|
+
<label for="email">Email</label>
|
|
110
|
+
<input type="email" id="email"
|
|
111
|
+
aria-invalid="true"
|
|
112
|
+
aria-describedby="email-error">
|
|
113
|
+
<p id="email-error" class="error" role="alert">
|
|
114
|
+
Please enter a valid email address (e.g., name@example.com)
|
|
115
|
+
</p>
|
|
116
|
+
</div>
|
|
117
|
+
</form>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
const form = document.querySelector('form');
|
|
122
|
+
const summary = document.getElementById('error-summary');
|
|
123
|
+
|
|
124
|
+
form.addEventListener('submit', (e) => {
|
|
125
|
+
const invalid = [...form.querySelectorAll('[aria-invalid="true"]')];
|
|
126
|
+
if (invalid.length === 0) return;
|
|
127
|
+
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
summary.textContent =
|
|
130
|
+
`${invalid.length} errors found. Please fix them and try again.`;
|
|
131
|
+
summary.hidden = false;
|
|
132
|
+
invalid[0].focus();
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This handler reports what the validation already marked: set `aria-invalid="true"` and the field's error text before submit runs.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Form labels
|
|
141
|
+
|
|
142
|
+
Every input needs an associated label, either explicit (`for`/`id`) or implicit (wrapping `<label>`).
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<!-- ❌ No label association -->
|
|
146
|
+
<input type="email" placeholder="Email">
|
|
147
|
+
|
|
148
|
+
<!-- ✅ Explicit label -->
|
|
149
|
+
<label for="email">Email address</label>
|
|
150
|
+
<input type="email" id="email" name="email"
|
|
151
|
+
autocomplete="email" required>
|
|
152
|
+
|
|
153
|
+
<!-- ✅ Implicit label -->
|
|
154
|
+
<label>
|
|
155
|
+
Email address
|
|
156
|
+
<input type="email" name="email" autocomplete="email" required>
|
|
157
|
+
</label>
|
|
158
|
+
|
|
159
|
+
<!-- ✅ With instructions -->
|
|
160
|
+
<label for="password">Password</label>
|
|
161
|
+
<input type="password" id="password"
|
|
162
|
+
aria-describedby="password-requirements">
|
|
163
|
+
<p id="password-requirements">
|
|
164
|
+
Must be at least 8 characters with one number.
|
|
165
|
+
</p>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Dragging movements
|
|
171
|
+
|
|
172
|
+
Any action triggered by dragging must offer a single-pointer alternative (WCAG 2.5.7).
|
|
173
|
+
|
|
174
|
+
```html
|
|
175
|
+
<!-- ❌ Drag-only reorder -->
|
|
176
|
+
<ul class="sortable-list" draggable="true">
|
|
177
|
+
<li>Item 1</li>
|
|
178
|
+
<li>Item 2</li>
|
|
179
|
+
</ul>
|
|
180
|
+
|
|
181
|
+
<!-- ✅ Drag + button alternatives -->
|
|
182
|
+
<ul class="sortable-list">
|
|
183
|
+
<li>
|
|
184
|
+
<span>Item 1</span>
|
|
185
|
+
<button aria-label="Move Item 1 up">↑</button>
|
|
186
|
+
<button aria-label="Move Item 1 down">↓</button>
|
|
187
|
+
</li>
|
|
188
|
+
<li>
|
|
189
|
+
<span>Item 2</span>
|
|
190
|
+
<button aria-label="Move Item 2 up">↑</button>
|
|
191
|
+
<button aria-label="Move Item 2 down">↓</button>
|
|
192
|
+
</li>
|
|
193
|
+
</ul>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Also applies to sliders, map panning, colour pickers, and similar drag-based widgets, always provide an equivalent click/tap or keyboard path.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## ARIA tabs
|
|
201
|
+
|
|
202
|
+
Tabs require `role="tablist"`, `role="tab"`, and `role="tabpanel"` with proper `aria-selected`, `aria-controls`, and keyboard support.
|
|
203
|
+
|
|
204
|
+
```html
|
|
205
|
+
<div role="tablist" aria-label="Product information">
|
|
206
|
+
<button role="tab" id="tab-1" aria-selected="true"
|
|
207
|
+
aria-controls="panel-1">Description</button>
|
|
208
|
+
<button role="tab" id="tab-2" aria-selected="false"
|
|
209
|
+
aria-controls="panel-2" tabindex="-1">Reviews</button>
|
|
210
|
+
</div>
|
|
211
|
+
<div role="tabpanel" id="panel-1" aria-labelledby="tab-1">
|
|
212
|
+
<!-- Panel content -->
|
|
213
|
+
</div>
|
|
214
|
+
<div role="tabpanel" id="panel-2" aria-labelledby="tab-2" hidden>
|
|
215
|
+
<!-- Panel content -->
|
|
216
|
+
</div>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Arrow keys should move focus between tabs; the active tab receives `tabindex="0"` while inactive tabs use `tabindex="-1"`.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Live regions and notifications
|
|
224
|
+
|
|
225
|
+
Use `aria-live` to announce dynamic content changes to screen readers without moving focus.
|
|
226
|
+
|
|
227
|
+
```html
|
|
228
|
+
<!-- Status updates (polite, waits for pause in speech) -->
|
|
229
|
+
<div id="polite-announcer" aria-live="polite" aria-atomic="true" class="status">
|
|
230
|
+
<!-- Content updates announced to screen readers -->
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<!-- Urgent alerts (assertive, interrupts) -->
|
|
234
|
+
<div id="assertive-announcer" role="alert" aria-live="assertive">
|
|
235
|
+
<!-- Interrupts current announcement -->
|
|
236
|
+
</div>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
```javascript
|
|
240
|
+
function showNotification(message, type = 'polite') {
|
|
241
|
+
const container = document.getElementById(`${type}-announcer`);
|
|
242
|
+
container.textContent = '';
|
|
243
|
+
requestAnimationFrame(() => {
|
|
244
|
+
container.textContent = message;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Clear the container before writing to ensure the same message triggers a new announcement.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# WCAG 2.2 Quick Reference
|
|
2
|
+
|
|
3
|
+
> Reference for antislop. Adapted from the MIT-licensed web-quality-skills by Addy Osmani (https://github.com/addyosmani/web-quality-skills); see LICENSE-web-quality-skills in the skill folder.
|
|
4
|
+
|
|
5
|
+
## Success criteria by level
|
|
6
|
+
|
|
7
|
+
### Level A (minimum)
|
|
8
|
+
|
|
9
|
+
| Criterion | Description |
|
|
10
|
+
|-----------|-------------|
|
|
11
|
+
| **1.1.1** Non-text Content | All images, icons have text alternatives |
|
|
12
|
+
| **1.2.1** Audio-only/Video-only | Provide transcript or audio description |
|
|
13
|
+
| **1.2.2** Captions | Video with audio has captions |
|
|
14
|
+
| **1.2.3** Audio Description | Video has audio description |
|
|
15
|
+
| **1.3.1** Info and Relationships | Information conveyed through presentation is available programmatically |
|
|
16
|
+
| **1.3.2** Meaningful Sequence | Reading order is logical |
|
|
17
|
+
| **1.3.3** Sensory Characteristics | Instructions don't rely solely on shape, color, size, location, orientation, or sound |
|
|
18
|
+
| **1.4.1** Use of Color | Color is not the only visual means of conveying information |
|
|
19
|
+
| **1.4.2** Audio Control | Audio playing automatically can be paused/stopped |
|
|
20
|
+
| **2.1.1** Keyboard | All functionality available via keyboard |
|
|
21
|
+
| **2.1.2** No Keyboard Trap | Keyboard focus can be moved away from any component |
|
|
22
|
+
| **2.1.4** Character Key Shortcuts | Single-key shortcuts can be turned off or remapped |
|
|
23
|
+
| **2.2.1** Timing Adjustable | Time limits can be extended |
|
|
24
|
+
| **2.2.2** Pause, Stop, Hide | Moving/blinking content can be paused |
|
|
25
|
+
| **2.3.1** Three Flashes | Nothing flashes more than 3 times per second |
|
|
26
|
+
| **2.4.1** Bypass Blocks | Skip link or landmark navigation available |
|
|
27
|
+
| **2.4.2** Page Titled | Pages have descriptive titles |
|
|
28
|
+
| **2.4.3** Focus Order | Focus order preserves meaning |
|
|
29
|
+
| **2.4.4** Link Purpose | Link purpose clear from link text or context |
|
|
30
|
+
| **2.5.1** Pointer Gestures | Multi-point gestures have single-pointer alternatives |
|
|
31
|
+
| **2.5.2** Pointer Cancellation | Down-event doesn't trigger action (use up-event or click) |
|
|
32
|
+
| **2.5.3** Label in Name | Accessible name contains visible label text |
|
|
33
|
+
| **2.5.4** Motion Actuation | Motion-triggered functions have alternatives |
|
|
34
|
+
| **3.1.1** Language of Page | Default language specified in HTML |
|
|
35
|
+
| **3.2.1** On Focus | Focus doesn't trigger unexpected changes |
|
|
36
|
+
| **3.2.2** On Input | Input doesn't trigger unexpected changes |
|
|
37
|
+
| **3.2.6** Consistent Help | Help mechanisms appear in the same relative order across pages |
|
|
38
|
+
| **3.3.1** Error Identification | Input errors clearly described |
|
|
39
|
+
| **3.3.2** Labels or Instructions | Form inputs have labels or instructions |
|
|
40
|
+
| **3.3.7** Redundant Entry | Information previously entered is auto-populated or available to select |
|
|
41
|
+
| **4.1.2** Name, Role, Value | UI components have accessible names and correct roles |
|
|
42
|
+
|
|
43
|
+
### Level AA (standard)
|
|
44
|
+
|
|
45
|
+
| Criterion | Description |
|
|
46
|
+
|-----------|-------------|
|
|
47
|
+
| **1.2.4** Captions (Live) | Live audio has captions |
|
|
48
|
+
| **1.2.5** Audio Description | Pre-recorded video has audio description |
|
|
49
|
+
| **1.3.4** Orientation | Content doesn't restrict orientation |
|
|
50
|
+
| **1.3.5** Identify Input Purpose | Input purpose can be programmatically determined |
|
|
51
|
+
| **1.4.3** Contrast (Minimum) | 4.5:1 for normal text, 3:1 for large text |
|
|
52
|
+
| **1.4.4** Resize Text | Text can be resized to 200% without loss of functionality |
|
|
53
|
+
| **1.4.5** Images of Text | Text used instead of images of text |
|
|
54
|
+
| **1.4.10** Reflow | Content reflows at 320px width without horizontal scroll |
|
|
55
|
+
| **1.4.11** Non-text Contrast | UI components have 3:1 contrast |
|
|
56
|
+
| **1.4.12** Text Spacing | Content adapts to text spacing changes |
|
|
57
|
+
| **1.4.13** Content on Hover/Focus | Additional content is dismissible, hoverable, persistent |
|
|
58
|
+
| **2.4.5** Multiple Ways | Multiple ways to find pages |
|
|
59
|
+
| **2.4.6** Headings and Labels | Headings and labels are descriptive |
|
|
60
|
+
| **2.4.7** Focus Visible | Focus indicator is visible |
|
|
61
|
+
| **2.4.11** Focus Not Obscured (Minimum) | Focused element is not entirely hidden by author-created content |
|
|
62
|
+
| **2.5.7** Dragging Movements | Dragging actions have single-pointer alternatives |
|
|
63
|
+
| **2.5.8** Target Size (Minimum) | Interactive targets are at least 24×24 CSS pixels (with exceptions) |
|
|
64
|
+
| **3.1.2** Language of Parts | Language changes are marked |
|
|
65
|
+
| **3.2.3** Consistent Navigation | Navigation is consistent across pages |
|
|
66
|
+
| **3.2.4** Consistent Identification | Same functionality uses same labels |
|
|
67
|
+
| **3.3.3** Error Suggestion | Error corrections suggested when known |
|
|
68
|
+
| **3.3.4** Error Prevention (Legal) | Actions can be reversed or confirmed |
|
|
69
|
+
| **3.3.8** Accessible Authentication (Minimum) | No cognitive function test for login unless an alternative or assistance is provided |
|
|
70
|
+
| **4.1.3** Status Messages | Status messages announced to screen readers |
|
|
71
|
+
|
|
72
|
+
### Level AAA (enhanced)
|
|
73
|
+
|
|
74
|
+
| Criterion | Description |
|
|
75
|
+
|-----------|-------------|
|
|
76
|
+
| **1.2.6** Sign Language (Prerecorded) | Pre-recorded video has a sign language interpretation |
|
|
77
|
+
| **1.2.7** Extended Audio Description (Prerecorded) | Video pauses long enough for audio description to convey the visuals |
|
|
78
|
+
| **1.2.8** Media Alternative (Prerecorded) | A text alternative covers everything the pre-recorded media shows |
|
|
79
|
+
| **1.2.9** Audio-only (Live) | Live audio-only content has a text alternative |
|
|
80
|
+
| **1.3.6** Identify Purpose | Icons and regions have a programmatically determined purpose |
|
|
81
|
+
| **1.4.6** Contrast (Enhanced) | 7:1 for normal text, 4.5:1 for large text |
|
|
82
|
+
| **1.4.7** Low or No Background Audio | Speech stays understandable over background sound |
|
|
83
|
+
| **1.4.8** Visual Presentation | Foreground/background colors can be selected |
|
|
84
|
+
| **1.4.9** Images of Text (No Exception) | No images of text |
|
|
85
|
+
| **2.1.3** Keyboard (No Exception) | All functionality keyboard accessible |
|
|
86
|
+
| **2.2.3** No Timing | No time limits |
|
|
87
|
+
| **2.2.4** Interruptions | Interruptions can be postponed |
|
|
88
|
+
| **2.2.5** Re-authenticating | Data preserved on re-authentication |
|
|
89
|
+
| **2.2.6** Timeouts | Users warned about data loss from inactivity |
|
|
90
|
+
| **2.3.2** Three Flashes | No content flashes more than 3 times |
|
|
91
|
+
| **2.3.3** Animation from Interactions | Motion animation can be disabled |
|
|
92
|
+
| **2.4.8** Location | User location within site is available |
|
|
93
|
+
| **2.4.9** Link Purpose (Link Only) | Link purpose clear from link text alone |
|
|
94
|
+
| **2.4.10** Section Headings | Sections have headings |
|
|
95
|
+
| **2.4.12** Focus Not Obscured (Enhanced) | No part of the focused element is hidden by author-created content |
|
|
96
|
+
| **2.4.13** Focus Appearance | Focus indicator has sufficient area, contrast, and is not obscured |
|
|
97
|
+
| **2.5.5** Target Size (Enhanced) | Interactive targets are at least 44×44 CSS pixels |
|
|
98
|
+
| **2.5.6** Concurrent Input Mechanisms | Content does not restrict which input modality a person uses |
|
|
99
|
+
| **3.1.3** Unusual Words | Definitions available for unusual words |
|
|
100
|
+
| **3.1.4** Abbreviations | Abbreviations expanded |
|
|
101
|
+
| **3.1.5** Reading Level | Alternative content for complex text |
|
|
102
|
+
| **3.1.6** Pronunciation | Pronunciation available where needed |
|
|
103
|
+
| **3.2.5** Change on Request | Changes initiated only by user |
|
|
104
|
+
| **3.3.5** Help | Context-sensitive help available |
|
|
105
|
+
| **3.3.6** Error Prevention (All) | All form submissions can be reviewed |
|
|
106
|
+
| **3.3.9** Accessible Authentication (Enhanced) | No cognitive function test for login (no object or personal content recognition exceptions) |
|
|
107
|
+
|
|
108
|
+
## What changed from 2.1 to 2.2
|
|
109
|
+
|
|
110
|
+
| Change | Criterion | Level |
|
|
111
|
+
|--------|-----------|-------|
|
|
112
|
+
| **Removed** | 4.1.1 Parsing | A |
|
|
113
|
+
| **Added** | 2.4.11 Focus Not Obscured (Minimum) | AA |
|
|
114
|
+
| **Added** | 2.4.12 Focus Not Obscured (Enhanced) | AAA |
|
|
115
|
+
| **Added** | 2.4.13 Focus Appearance | AAA |
|
|
116
|
+
| **Added** | 2.5.7 Dragging Movements | AA |
|
|
117
|
+
| **Added** | 2.5.8 Target Size (Minimum) | AA |
|
|
118
|
+
| **Added** | 3.2.6 Consistent Help | A |
|
|
119
|
+
| **Added** | 3.3.7 Redundant Entry | A |
|
|
120
|
+
| **Added** | 3.3.8 Accessible Authentication (Minimum) | AA |
|
|
121
|
+
| **Added** | 3.3.9 Accessible Authentication (Enhanced) | AAA |
|
|
122
|
+
|
|
123
|
+
## Sources
|
|
124
|
+
|
|
125
|
+
- [WCAG 2.2 W3C Recommendation](https://www.w3.org/TR/WCAG22/)
|
|
126
|
+
- [WCAG 2.2 Quick Reference](https://www.w3.org/WAI/WCAG22/quickref/)
|
|
127
|
+
- [What's New in WCAG 2.2](https://www.w3.org/WAI/standards-guidelines/wcag/new-in-22/)
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Core Web Vitals (LCP, INP, CLS)
|
|
2
|
+
|
|
3
|
+
> Reference for antislop. Adapted from the MIT-licensed web-quality-skills by Addy Osmani (https://github.com/addyosmani/web-quality-skills); see LICENSE-web-quality-skills in the skill folder.
|
|
4
|
+
|
|
5
|
+
Targeted optimization for the three Core Web Vitals using field data to identify user impact and browser traces to diagnose causes.
|
|
6
|
+
|
|
7
|
+
## Measure before optimizing
|
|
8
|
+
|
|
9
|
+
When a runnable URL is available, prefer this sequence:
|
|
10
|
+
|
|
11
|
+
1. Check page-level CrUX p75 data, with a clearly labeled origin fallback when page data is unavailable.
|
|
12
|
+
2. Record a browser performance trace under stated conditions. With Chrome DevTools MCP, trace summaries can include CrUX alongside the observed lab metrics.
|
|
13
|
+
3. Analyze only the insights associated with the failing metric, then inspect the implicated code and resources.
|
|
14
|
+
4. Re-run equivalent lab measurements after the fix. Do not claim an immediate field improvement; CrUX and first-party RUM need new user visits.
|
|
15
|
+
|
|
16
|
+
If only source code is available, identify likely causes but do not claim that LCP, INP, or CLS is failing without runtime evidence.
|
|
17
|
+
|
|
18
|
+
## The three metrics
|
|
19
|
+
|
|
20
|
+
| Metric | Measures | Good | Needs work | Poor |
|
|
21
|
+
|--------|----------|------|------------|------|
|
|
22
|
+
| **LCP** | Loading | ≤ 2.5s | 2.5s to 4s | > 4s |
|
|
23
|
+
| **INP** | Interactivity | ≤ 200ms | 200ms to 500ms | > 500ms |
|
|
24
|
+
| **CLS** | Visual Stability | ≤ 0.1 | 0.1 to 0.25 | > 0.25 |
|
|
25
|
+
|
|
26
|
+
Google measures at the **75th percentile**: 75% of page visits must meet "Good" thresholds.
|
|
27
|
+
|
|
28
|
+
These are the numbers R-40 keeps out of the Hard Gate. They describe real visits, so compare a page against them only with a real measurement in hand, and report "not measured" otherwise (R-36).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## LCP: Largest Contentful Paint
|
|
33
|
+
|
|
34
|
+
LCP measures when the largest visible content element renders. Usually this is:
|
|
35
|
+
- Hero image or video
|
|
36
|
+
- Large text block
|
|
37
|
+
- Background image
|
|
38
|
+
- `<svg>` element
|
|
39
|
+
|
|
40
|
+
### Common LCP issues
|
|
41
|
+
|
|
42
|
+
**1. Slow server response (TTFB > 800ms)**
|
|
43
|
+
```
|
|
44
|
+
Fix: CDN, caching, optimized backend, edge rendering
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**2. Render-blocking resources**
|
|
48
|
+
```html
|
|
49
|
+
<!-- ❌ Blocks rendering -->
|
|
50
|
+
<link rel="stylesheet" href="/all-styles.css">
|
|
51
|
+
|
|
52
|
+
<!-- ✅ Critical CSS inlined, rest deferred -->
|
|
53
|
+
<style>/* Critical above-fold CSS */</style>
|
|
54
|
+
<link rel="preload" href="/styles.css" as="style"
|
|
55
|
+
onload="this.onload=null;this.rel='stylesheet'">
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**3. Slow resource load times**
|
|
59
|
+
```html
|
|
60
|
+
<!-- ❌ LCP image is discovered only after a stylesheet loads -->
|
|
61
|
+
<div class="hero"></div>
|
|
62
|
+
|
|
63
|
+
<!-- ✅ Discoverable in initial HTML and prioritized -->
|
|
64
|
+
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">
|
|
65
|
+
<img src="/hero.webp" alt="Hero" fetchpriority="high">
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Prefer a discoverable `<img>` with `fetchpriority="high"`. Add the preload only when the trace shows that the resource would otherwise be discovered late; duplicate or speculative preloads can compete for bandwidth.
|
|
69
|
+
|
|
70
|
+
**4. Client-side rendering delays**
|
|
71
|
+
```javascript
|
|
72
|
+
// ❌ Content loads after JavaScript
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
fetch('/api/hero-text').then(r => r.json()).then(setHeroText);
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
// ✅ Server-side or static rendering
|
|
78
|
+
// Use SSR, SSG, or streaming to send HTML with content
|
|
79
|
+
export async function getServerSideProps() {
|
|
80
|
+
const heroText = await fetchHeroText();
|
|
81
|
+
return { props: { heroText } };
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**5. Make navigations instant with the Speculation Rules API**
|
|
86
|
+
|
|
87
|
+
For sites with predictable same-origin journeys, prerendering a likely next page can make a successful subsequent navigation much faster. Treat this as a measured navigation optimization, not a substitute for fixing the current page's LCP.
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<script type="speculationrules">
|
|
91
|
+
{
|
|
92
|
+
"prerender": [{
|
|
93
|
+
"where": { "href_matches": "/*" },
|
|
94
|
+
"eagerness": "moderate"
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Current Chrome behavior is specific enough to guide the choice:
|
|
101
|
+
|
|
102
|
+
| `eagerness` | Trigger |
|
|
103
|
+
|-------------|---------|
|
|
104
|
+
| `conservative` | Pointer or touch down |
|
|
105
|
+
| `moderate` | Desktop: 200ms hover, or earlier pointer down; mobile: viewport heuristics |
|
|
106
|
+
| `eager` | Chrome 143+: desktop 10ms hover; mobile 50ms after the anchor enters the viewport |
|
|
107
|
+
| `immediate` | As soon as the rules are observed |
|
|
108
|
+
|
|
109
|
+
Start conservatively and measure prediction hit rate, transferred bytes, server load, and navigation improvement before expanding the rules. Recheck [Chrome's maintained eagerness documentation](https://developer.chrome.com/docs/web-platform/prerender-pages#eagerness) before hardcoding timing-sensitive behavior.
|
|
110
|
+
|
|
111
|
+
Caveats:
|
|
112
|
+
- **Bandwidth/CPU cost.** Each prerender is roughly a full page load. Scope `where` carefully (`href_matches` patterns, exclude logout/checkout) and avoid `immediate` outside small sites.
|
|
113
|
+
- **Side effects fire early.** Analytics, ads, and any code that runs on load will fire when the prerender starts, not when the user navigates. Gate side effects on the [`prerenderingchange` event](https://developer.chrome.com/docs/web-platform/prerender-pages#detect_when_a_page_is_prerendered_or_used_for_a_full_navigation) or `document.prerendering`.
|
|
114
|
+
- **Chromium-only.** Safari and Firefox ignore the script, it's a progressive enhancement, never a regression.
|
|
115
|
+
|
|
116
|
+
### LCP optimization checklist
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
- [ ] TTFB < 800ms (use CDN, edge caching)
|
|
120
|
+
- [ ] LCP resource is discoverable in initial HTML and prioritized; preload only if the trace shows late discovery
|
|
121
|
+
- [ ] LCP image optimized (WebP/AVIF, correct size)
|
|
122
|
+
- [ ] Critical CSS inlined (< 14KB)
|
|
123
|
+
- [ ] No render-blocking JavaScript in <head>
|
|
124
|
+
- [ ] Fonts don't block text rendering (font-display: swap)
|
|
125
|
+
- [ ] LCP element in initial HTML (not JS-rendered)
|
|
126
|
+
- [ ] Speculation Rules added for likely-next navigations (moderate eagerness)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### LCP element identification
|
|
130
|
+
|
|
131
|
+
This snippet diagnoses the current page session. It is not field data.
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
// Find your LCP element
|
|
135
|
+
new PerformanceObserver((list) => {
|
|
136
|
+
const entries = list.getEntries();
|
|
137
|
+
const lastEntry = entries[entries.length - 1];
|
|
138
|
+
console.log('LCP element:', lastEntry.element);
|
|
139
|
+
console.log('LCP time:', lastEntry.startTime);
|
|
140
|
+
}).observe({ type: 'largest-contentful-paint', buffered: true });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## INP: Interaction to Next Paint
|
|
146
|
+
|
|
147
|
+
INP measures responsiveness across clicks, taps, and key presses during a visit. Diagnose its input delay, processing time, and presentation delay separately; a slow interaction may involve main-thread contention before the handler, expensive application work, or delayed rendering after it.
|
|
148
|
+
|
|
149
|
+
When field INP is poor or a trace identifies a slow interaction, read [web.dev on optimizing INP](https://web.dev/articles/optimize-inp) for trace interpretation, yielding patterns, and third-party and rendering causes.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## CLS: Cumulative Layout Shift
|
|
154
|
+
|
|
155
|
+
CLS measures unexpected layout shifts across a page visit. Use field attribution or a trace to identify the shifted node and the trigger; do not assume the visible victim caused the shift.
|
|
156
|
+
|
|
157
|
+
When field CLS is poor or a trace reports shifts, read [web.dev on optimizing CLS](https://web.dev/articles/optimize-cls) for reserved-space patterns, dynamic content, and font and animation fixes.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Measurement sources
|
|
162
|
+
|
|
163
|
+
| Source | Use |
|
|
164
|
+
|--------|-----|
|
|
165
|
+
| Browser performance trace (Chrome DevTools MCP: `performance_start_trace`) | Observe one load or interaction and diagnose focused insights; use included CrUX context when available |
|
|
166
|
+
| CrUX or Search Console | Prioritize aggregated real-user outcomes at p75 |
|
|
167
|
+
| Lighthouse CLI or PageSpeed Insights | Controlled lab fallback when DevTools tools are unavailable |
|
|
168
|
+
| First-party RUM | Segment current production experience by route, device, release, and attribution |
|
|
169
|
+
| Raw `PerformanceObserver` | Inspect one page session during debugging |
|
|
170
|
+
|
|
171
|
+
Do not route performance through Chrome DevTools MCP's `lighthouse_audit`; that capability intentionally covers non-performance Lighthouse categories. Do not compare a single lab value directly with a field p75 as if they were equivalent samples.
|
|
172
|
+
|
|
173
|
+
When adding or reviewing production collection, read [the `web-vitals` library documentation](https://github.com/GoogleChrome/web-vitals). Prefer the `web-vitals` library because raw browser APIs do not by themselves implement every Core Web Vital's lifecycle and reporting rules.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## References
|
|
178
|
+
|
|
179
|
+
- [web.dev LCP](https://web.dev/articles/lcp) and [optimizing LCP](https://web.dev/articles/optimize-lcp)
|
|
180
|
+
- [web.dev INP](https://web.dev/articles/inp)
|
|
181
|
+
- [web.dev CLS](https://web.dev/articles/cls)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Web Baseline
|
|
2
|
+
|
|
3
|
+
> Reference for antislop. Adapted from the MIT-licensed web-quality-skills by Addy Osmani (https://github.com/addyosmani/web-quality-skills); see LICENSE-web-quality-skills in the skill folder.
|
|
4
|
+
|
|
5
|
+
Page basics and security defaults. This is an optional checklist, not a Hard Gate rule: run it when the task asks for a production-ready page or a web-quality review. None of it shows in a screenshot, which is why it is easy to skip.
|
|
6
|
+
|
|
7
|
+
## Document basics
|
|
8
|
+
|
|
9
|
+
- `<!doctype html>` first, so the page never renders in quirks mode.
|
|
10
|
+
- `<meta charset="utf-8">` first in `<head>`.
|
|
11
|
+
- `<meta name="viewport" content="width=device-width, initial-scale=1">` (zoom stays allowed, R-39).
|
|
12
|
+
- Valid, semantic HTML with no duplicate `id`.
|
|
13
|
+
|
|
14
|
+
## Runtime
|
|
15
|
+
|
|
16
|
+
Console errors are already R-35.
|
|
17
|
+
|
|
18
|
+
- No deprecated APIs: `document.write`, synchronous XHR, `unload` listeners.
|
|
19
|
+
- Scroll and touch listeners are `{ passive: true }` where they do not call `preventDefault`.
|
|
20
|
+
|
|
21
|
+
## Security defaults
|
|
22
|
+
|
|
23
|
+
- HTTPS for every resource, with no mixed `http://` content.
|
|
24
|
+
- External links opened in a new tab carry `rel="noopener noreferrer"`.
|
|
25
|
+
- No secrets, API keys, or tokens in client code; they stay on the server.
|
|
26
|
+
- `textContent` or a sanitizer instead of `innerHTML` or `eval` with untrusted input.
|
|
27
|
+
- Third-party scripts and styles from a CDN you do not control are pinned with Subresource Integrity.
|
|
28
|
+
- Permissions (location, notifications, camera) are requested after a user action, never on page load.
|