@sylix/coworker 2.0.11 → 2.0.14

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.
Files changed (169) hide show
  1. package/dist/commands/slash/config.d.ts.map +1 -1
  2. package/dist/commands/slash/config.js +22 -4
  3. package/dist/commands/slash/config.js.map +1 -1
  4. package/dist/core/CoWorkerAgent.d.ts.map +1 -1
  5. package/dist/core/CoWorkerAgent.js +6 -3
  6. package/dist/core/CoWorkerAgent.js.map +1 -1
  7. package/dist/skills/defaults/accessibility/screen-reader-testing.md +545 -0
  8. package/dist/skills/defaults/accessibility/wcag-audit-patterns.md +555 -0
  9. package/dist/skills/defaults/ai-ml/rag.md +276 -0
  10. package/dist/skills/defaults/backend-development/api-design-principles.md +528 -0
  11. package/dist/skills/defaults/backend-development/api-design.md +285 -0
  12. package/dist/skills/defaults/backend-development/architecture-patterns.md +494 -0
  13. package/dist/skills/defaults/backend-development/async-python.md +237 -0
  14. package/dist/skills/defaults/backend-development/auth-implementation-patterns.md +638 -0
  15. package/dist/skills/defaults/backend-development/bazel-build-optimization.md +387 -0
  16. package/dist/skills/defaults/backend-development/billing-automation/SKILL.md +566 -0
  17. package/dist/skills/defaults/backend-development/code-review-excellence.md +538 -0
  18. package/dist/skills/defaults/backend-development/cqrs-implementation.md +554 -0
  19. package/dist/skills/defaults/backend-development/database-design.md +305 -0
  20. package/dist/skills/defaults/backend-development/debugging-strategies.md +536 -0
  21. package/dist/skills/defaults/backend-development/e2e-testing-patterns.md +544 -0
  22. package/dist/skills/defaults/backend-development/error-handling-patterns.md +641 -0
  23. package/dist/skills/defaults/backend-development/fastapi-templates.md +559 -0
  24. package/dist/skills/defaults/backend-development/fastapi.md +309 -0
  25. package/dist/skills/defaults/backend-development/git-advanced-workflows.md +405 -0
  26. package/dist/skills/defaults/backend-development/microservices-patterns.md +595 -0
  27. package/dist/skills/defaults/backend-development/microservices.md +284 -0
  28. package/dist/skills/defaults/backend-development/monorepo-management.md +623 -0
  29. package/dist/skills/defaults/backend-development/nodejs-backend-patterns.md +1048 -0
  30. package/dist/skills/defaults/backend-development/nx-workspace-patterns.md +457 -0
  31. package/dist/skills/defaults/backend-development/paypal-integration/SKILL.md +478 -0
  32. package/dist/skills/defaults/backend-development/pci-compliance/SKILL.md +480 -0
  33. package/dist/skills/defaults/backend-development/python-anti-patterns.md +349 -0
  34. package/dist/skills/defaults/backend-development/python-background-jobs.md +364 -0
  35. package/dist/skills/defaults/backend-development/python-code-style.md +360 -0
  36. package/dist/skills/defaults/backend-development/python-configuration.md +368 -0
  37. package/dist/skills/defaults/backend-development/python-design-patterns.md +296 -0
  38. package/dist/skills/defaults/backend-development/python-error-handling.md +323 -0
  39. package/dist/skills/defaults/backend-development/python-packaging.md +887 -0
  40. package/dist/skills/defaults/backend-development/python-performance-optimization.md +874 -0
  41. package/dist/skills/defaults/backend-development/python-project-structure.md +252 -0
  42. package/dist/skills/defaults/backend-development/python-resilience.md +376 -0
  43. package/dist/skills/defaults/backend-development/python-resource-management.md +421 -0
  44. package/dist/skills/defaults/backend-development/python-type-safety.md +428 -0
  45. package/dist/skills/defaults/backend-development/sql-optimization-patterns.md +509 -0
  46. package/dist/skills/defaults/backend-development/stripe-integration/SKILL.md +522 -0
  47. package/dist/skills/defaults/backend-development/turborepo-caching.md +376 -0
  48. package/dist/skills/defaults/blockchain/defi-protocol-templates.md +430 -0
  49. package/dist/skills/defaults/blockchain/nft-standards.md +364 -0
  50. package/dist/skills/defaults/blockchain/solidity-security.md +514 -0
  51. package/dist/skills/defaults/blockchain/web3-testing.md +360 -0
  52. package/dist/skills/defaults/business/competitive-landscape/SKILL.md +527 -0
  53. package/dist/skills/defaults/business/market-sizing-analysis/SKILL.md +451 -0
  54. package/dist/skills/defaults/business/startup-financial-modeling/SKILL.md +494 -0
  55. package/dist/skills/defaults/business/startup-metrics-framework/SKILL.md +564 -0
  56. package/dist/skills/defaults/business/team-composition-analysis.md +437 -0
  57. package/dist/skills/defaults/compliance/employment-contract-templates/SKILL.md +527 -0
  58. package/dist/skills/defaults/compliance/gdpr-data-handling/SKILL.md +630 -0
  59. package/dist/skills/defaults/data-engineering/airflow-dag-patterns.md +436 -0
  60. package/dist/skills/defaults/data-engineering/airflow.md +519 -0
  61. package/dist/skills/defaults/data-engineering/data-quality.md +583 -0
  62. package/dist/skills/defaults/data-engineering/dbt-transformation-patterns.md +482 -0
  63. package/dist/skills/defaults/data-engineering/dbt.md +556 -0
  64. package/dist/skills/defaults/data-engineering/ml-pipeline-workflow/SKILL.md +247 -0
  65. package/dist/skills/defaults/data-engineering/spark-optimization.md +348 -0
  66. package/dist/skills/defaults/data-engineering/spark.md +411 -0
  67. package/dist/skills/defaults/database/postgresql.md +202 -0
  68. package/dist/skills/defaults/debugging/systematic-debugging.md +249 -0
  69. package/dist/skills/defaults/devops/architecture-decision-records.md +448 -0
  70. package/dist/skills/defaults/devops/changelog-automation.md +580 -0
  71. package/dist/skills/defaults/devops/cicd.md +314 -0
  72. package/dist/skills/defaults/devops/cloud.md +263 -0
  73. package/dist/skills/defaults/devops/code-review-excellence.md +299 -0
  74. package/dist/skills/defaults/devops/cost-optimization.md +295 -0
  75. package/dist/skills/defaults/devops/deployment-pipeline-design.md +356 -0
  76. package/dist/skills/defaults/devops/docker.md +281 -0
  77. package/dist/skills/defaults/devops/git-workflows.md +205 -0
  78. package/dist/skills/defaults/devops/github-actions.md +311 -0
  79. package/dist/skills/defaults/devops/gitlab-ci-patterns.md +266 -0
  80. package/dist/skills/defaults/devops/hybrid-cloud-networking.md +241 -0
  81. package/dist/skills/defaults/devops/istio-traffic-management.md +327 -0
  82. package/dist/skills/defaults/devops/kubernetes.md +339 -0
  83. package/dist/skills/defaults/devops/linkerd-patterns.md +311 -0
  84. package/dist/skills/defaults/devops/multi-cloud-architecture.md +181 -0
  85. package/dist/skills/defaults/devops/observability.md +243 -0
  86. package/dist/skills/defaults/devops/openapi-spec-generation.md +1024 -0
  87. package/dist/skills/defaults/devops/postmortem-writing.md +396 -0
  88. package/dist/skills/defaults/devops/prometheus-configuration.md +265 -0
  89. package/dist/skills/defaults/devops/secrets-management.md +341 -0
  90. package/dist/skills/defaults/devops/service-mesh-observability.md +385 -0
  91. package/dist/skills/defaults/devops/terraform-module-library.md +244 -0
  92. package/dist/skills/defaults/finance/backtesting-frameworks/SKILL.md +663 -0
  93. package/dist/skills/defaults/finance/risk-metrics-calculation/SKILL.md +557 -0
  94. package/dist/skills/defaults/frontend/accessibility-compliance.md +420 -0
  95. package/dist/skills/defaults/frontend/design-system-patterns.md +337 -0
  96. package/dist/skills/defaults/frontend/interaction-design.md +327 -0
  97. package/dist/skills/defaults/frontend/javascript.md +311 -0
  98. package/dist/skills/defaults/frontend/modern-javascript-patterns.md +927 -0
  99. package/dist/skills/defaults/frontend/react-native-design.md +440 -0
  100. package/dist/skills/defaults/frontend/react.md +345 -0
  101. package/dist/skills/defaults/frontend/responsive-design.md +472 -0
  102. package/dist/skills/defaults/frontend/tailwind-design-system.md +337 -0
  103. package/dist/skills/defaults/frontend/typescript-advanced-types.md +724 -0
  104. package/dist/skills/defaults/frontend/typescript.md +334 -0
  105. package/dist/skills/defaults/frontend/visual-design-foundations.md +326 -0
  106. package/dist/skills/defaults/frontend/web-component-design.md +279 -0
  107. package/dist/skills/defaults/game-development/godot-gdscript-patterns.md +188 -0
  108. package/dist/skills/defaults/game-development/unity-ecs-patterns.md +594 -0
  109. package/dist/skills/defaults/kubernetes/gitops-workflow.md +285 -0
  110. package/dist/skills/defaults/kubernetes/gitops.md +280 -0
  111. package/dist/skills/defaults/kubernetes/helm-chart-scaffolding.md +553 -0
  112. package/dist/skills/defaults/kubernetes/helm.md +343 -0
  113. package/dist/skills/defaults/kubernetes/k8s-manifest-generator.md +501 -0
  114. package/dist/skills/defaults/kubernetes/k8s-security-policies.md +342 -0
  115. package/dist/skills/defaults/kubernetes/manifests.md +330 -0
  116. package/dist/skills/defaults/kubernetes/security.md +337 -0
  117. package/dist/skills/defaults/llm-application/embedding-strategies.md +608 -0
  118. package/dist/skills/defaults/llm-application/hybrid-search-implementation.md +570 -0
  119. package/dist/skills/defaults/llm-application/hybrid-search.md +570 -0
  120. package/dist/skills/defaults/llm-application/langchain-architecture.md +666 -0
  121. package/dist/skills/defaults/llm-application/langchain.md +259 -0
  122. package/dist/skills/defaults/llm-application/llm-evaluation.md +695 -0
  123. package/dist/skills/defaults/llm-application/prompt-engineering-patterns.md +449 -0
  124. package/dist/skills/defaults/llm-application/prompt-engineering.md +219 -0
  125. package/dist/skills/defaults/llm-application/rag-implementation.md +434 -0
  126. package/dist/skills/defaults/llm-application/similarity-search-patterns.md +560 -0
  127. package/dist/skills/defaults/llm-application/similarity-search.md +560 -0
  128. package/dist/skills/defaults/llm-application/vector-index-tuning.md +523 -0
  129. package/dist/skills/defaults/mobile/mobile-android-design.md +440 -0
  130. package/dist/skills/defaults/mobile/mobile-ios-design.md +266 -0
  131. package/dist/skills/defaults/monitoring/distributed-tracing.md +436 -0
  132. package/dist/skills/defaults/monitoring/grafana-dashboards.md +370 -0
  133. package/dist/skills/defaults/monitoring/prometheus-configuration.md +379 -0
  134. package/dist/skills/defaults/monitoring/slo-implementation.md +323 -0
  135. package/dist/skills/defaults/refactoring/code-refactoring.md +349 -0
  136. package/dist/skills/defaults/security/anti-reversing-techniques/SKILL.md +559 -0
  137. package/dist/skills/defaults/security/auditor.md +168 -0
  138. package/dist/skills/defaults/security/binary-analysis-patterns/SKILL.md +438 -0
  139. package/dist/skills/defaults/security/memory-forensics/SKILL.md +483 -0
  140. package/dist/skills/defaults/security/mtls-configuration.md +349 -0
  141. package/dist/skills/defaults/security/protocol-reverse-engineering/SKILL.md +520 -0
  142. package/dist/skills/defaults/security/sast-configuration.md +182 -0
  143. package/dist/skills/defaults/security/security.md +313 -0
  144. package/dist/skills/defaults/security/stride-analysis.md +273 -0
  145. package/dist/skills/defaults/security/threat-mitigation-mapping.md +290 -0
  146. package/dist/skills/defaults/systems/bash-defensive-patterns/SKILL.md +539 -0
  147. package/dist/skills/defaults/systems/bats-testing-patterns/SKILL.md +631 -0
  148. package/dist/skills/defaults/systems/go-concurrency-patterns.md +657 -0
  149. package/dist/skills/defaults/systems/memory-safety-patterns.md +605 -0
  150. package/dist/skills/defaults/systems/rust-async-patterns.md +519 -0
  151. package/dist/skills/defaults/systems/shellcheck-configuration/SKILL.md +456 -0
  152. package/dist/skills/defaults/team-collaboration/multi-reviewer-patterns.md +126 -0
  153. package/dist/skills/defaults/team-collaboration/parallel-feature-development.md +151 -0
  154. package/dist/skills/defaults/testing/javascript-testing-patterns.md +1021 -0
  155. package/dist/skills/defaults/testing/python-testing-patterns.md +351 -0
  156. package/dist/skills/defaults/testing/testing.md +332 -0
  157. package/dist/skills/defaults/workflows/context-driven-development.md +384 -0
  158. package/dist/skills/defaults/workflows/track-management.md +592 -0
  159. package/dist/skills/defaults/workflows/workflow-patterns.md +622 -0
  160. package/dist/skills/index.d.ts +11 -0
  161. package/dist/skills/index.d.ts.map +1 -0
  162. package/dist/skills/index.js +129 -0
  163. package/dist/skills/index.js.map +1 -0
  164. package/dist/utils/character.js +4 -4
  165. package/dist/utils/character.js.map +1 -1
  166. package/dist/utils/inputbar.d.ts.map +1 -1
  167. package/dist/utils/inputbar.js +7 -0
  168. package/dist/utils/inputbar.js.map +1 -1
  169. package/package.json +1 -1
@@ -0,0 +1,420 @@
1
+ ---
2
+ name: accessibility-compliance
3
+ description: Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.
4
+ ---
5
+
6
+ # Accessibility Compliance
7
+
8
+ Master accessibility implementation to create inclusive experiences that work for everyone, including users with disabilities.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Implementing WCAG 2.2 Level AA or AAA compliance
13
+ - Building screen reader accessible interfaces
14
+ - Adding keyboard navigation to interactive components
15
+ - Implementing focus management and focus trapping
16
+ - Creating accessible forms with proper labeling
17
+ - Supporting reduced motion and high contrast preferences
18
+ - Building mobile accessibility features (iOS VoiceOver, Android TalkBack)
19
+ - Conducting accessibility audits and fixing violations
20
+
21
+ ## Core Capabilities
22
+
23
+ ### 1. WCAG 2.2 Guidelines
24
+
25
+ - Perceivable: Content must be presentable in different ways
26
+ - Operable: Interface must be navigable with keyboard and assistive tech
27
+ - Understandable: Content and operation must be clear
28
+ - Robust: Content must work with current and future assistive technologies
29
+
30
+ ### 2. ARIA Patterns
31
+
32
+ - Roles: Define element purpose (button, dialog, navigation)
33
+ - States: Indicate current condition (expanded, selected, disabled)
34
+ - Properties: Describe relationships and additional info (labelledby, describedby)
35
+ - Live regions: Announce dynamic content changes
36
+
37
+ ### 3. Keyboard Navigation
38
+
39
+ - Focus order and tab sequence
40
+ - Focus indicators and visible focus states
41
+ - Keyboard shortcuts and hotkeys
42
+ - Focus trapping for modals and dialogs
43
+
44
+ ### 4. Screen Reader Support
45
+
46
+ - Semantic HTML structure
47
+ - Alternative text for images
48
+ - Proper heading hierarchy
49
+ - Skip links and landmarks
50
+
51
+ ### 5. Mobile Accessibility
52
+
53
+ - Touch target sizing (44x44dp minimum)
54
+ - VoiceOver and TalkBack compatibility
55
+ - Gesture alternatives
56
+ - Dynamic Type support
57
+
58
+ ## Quick Reference
59
+
60
+ ### WCAG 2.2 Success Criteria Checklist
61
+
62
+ | Level | Criterion | Description |
63
+ | ----- | --------- | ---------------------------------------------------- |
64
+ | A | 1.1.1 | Non-text content has text alternatives |
65
+ | A | 1.3.1 | Info and relationships programmatically determinable |
66
+ | A | 2.1.1 | All functionality keyboard accessible |
67
+ | A | 2.4.1 | Skip to main content mechanism |
68
+ | AA | 1.4.3 | Contrast ratio 4.5:1 (text), 3:1 (large text) |
69
+ | AA | 1.4.11 | Non-text contrast 3:1 |
70
+ | AA | 2.4.7 | Focus visible |
71
+ | AA | 2.5.8 | Target size minimum 24x24px (NEW in 2.2) |
72
+ | AAA | 1.4.6 | Enhanced contrast 7:1 |
73
+ | AAA | 2.5.5 | Target size minimum 44x44px |
74
+
75
+ ## Key Patterns
76
+
77
+ ### Pattern 1: Accessible Button
78
+
79
+ ```tsx
80
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
81
+ variant?: "primary" | "secondary";
82
+ isLoading?: boolean;
83
+ }
84
+
85
+ function AccessibleButton({
86
+ children,
87
+ variant = "primary",
88
+ isLoading = false,
89
+ disabled,
90
+ ...props
91
+ }: ButtonProps) {
92
+ return (
93
+ <button
94
+ // Disable when loading
95
+ disabled={disabled || isLoading}
96
+ // Announce loading state to screen readers
97
+ aria-busy={isLoading}
98
+ // Describe the button's current state
99
+ aria-disabled={disabled || isLoading}
100
+ className={cn(
101
+ // Visible focus ring
102
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
103
+ // Minimum touch target size (44x44px)
104
+ "min-h-[44px] min-w-[44px]",
105
+ variant === "primary" && "bg-primary text-primary-foreground",
106
+ (disabled || isLoading) && "opacity-50 cursor-not-allowed",
107
+ )}
108
+ {...props}
109
+ >
110
+ {isLoading ? (
111
+ <>
112
+ <span className="sr-only">Loading</span>
113
+ <Spinner aria-hidden="true" />
114
+ </>
115
+ ) : (
116
+ children
117
+ )}
118
+ </button>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ### Pattern 2: Accessible Modal Dialog
124
+
125
+ ```tsx
126
+ import * as React from "react";
127
+ import { FocusTrap } from "@headlessui/react";
128
+
129
+ interface DialogProps {
130
+ isOpen: boolean;
131
+ onClose: () => void;
132
+ title: string;
133
+ children: React.ReactNode;
134
+ }
135
+
136
+ function AccessibleDialog({ isOpen, onClose, title, children }: DialogProps) {
137
+ const titleId = React.useId();
138
+ const descriptionId = React.useId();
139
+
140
+ // Close on Escape key
141
+ React.useEffect(() => {
142
+ const handleKeyDown = (e: KeyboardEvent) => {
143
+ if (e.key === "Escape" && isOpen) {
144
+ onClose();
145
+ }
146
+ };
147
+ document.addEventListener("keydown", handleKeyDown);
148
+ return () => document.removeEventListener("keydown", handleKeyDown);
149
+ }, [isOpen, onClose]);
150
+
151
+ // Prevent body scroll when open
152
+ React.useEffect(() => {
153
+ if (isOpen) {
154
+ document.body.style.overflow = "hidden";
155
+ }
156
+ return () => {
157
+ document.body.style.overflow = "";
158
+ };
159
+ }, [isOpen]);
160
+
161
+ if (!isOpen) return null;
162
+
163
+ return (
164
+ <div
165
+ role="dialog"
166
+ aria-modal="true"
167
+ aria-labelledby={titleId}
168
+ aria-describedby={descriptionId}
169
+ >
170
+ {/* Backdrop */}
171
+ <div
172
+ className="fixed inset-0 bg-black/50"
173
+ aria-hidden="true"
174
+ onClick={onClose}
175
+ />
176
+
177
+ {/* Focus trap container */}
178
+ <FocusTrap>
179
+ <div className="fixed inset-0 flex items-center justify-center p-4">
180
+ <div className="bg-background rounded-lg shadow-lg max-w-md w-full p-6">
181
+ <h2 id={titleId} className="text-lg font-semibold">
182
+ {title}
183
+ </h2>
184
+ <div id={descriptionId}>{children}</div>
185
+ <button
186
+ onClick={onClose}
187
+ className="absolute top-4 right-4"
188
+ aria-label="Close dialog"
189
+ >
190
+ <X className="h-4 w-4" />
191
+ </button>
192
+ </div>
193
+ </div>
194
+ </FocusTrap>
195
+ </div>
196
+ );
197
+ }
198
+ ```
199
+
200
+ ### Pattern 3: Accessible Form
201
+
202
+ ```tsx
203
+ function AccessibleForm() {
204
+ const [errors, setErrors] = React.useState<Record<string, string>>({});
205
+
206
+ return (
207
+ <form aria-describedby="form-errors" noValidate>
208
+ {/* Error summary for screen readers */}
209
+ {Object.keys(errors).length > 0 && (
210
+ <div
211
+ id="form-errors"
212
+ role="alert"
213
+ aria-live="assertive"
214
+ className="bg-destructive/10 border border-destructive p-4 rounded-md mb-4"
215
+ >
216
+ <h2 className="font-semibold text-destructive">
217
+ Please fix the following errors:
218
+ </h2>
219
+ <ul className="list-disc list-inside mt-2">
220
+ {Object.entries(errors).map(([field, message]) => (
221
+ <li key={field}>
222
+ <a href={`#${field}`} className="underline">
223
+ {message}
224
+ </a>
225
+ </li>
226
+ ))}
227
+ </ul>
228
+ </div>
229
+ )}
230
+
231
+ {/* Required field with error */}
232
+ <div className="space-y-2">
233
+ <label htmlFor="email" className="block font-medium">
234
+ Email address
235
+ <span aria-hidden="true" className="text-destructive ml-1">
236
+ *
237
+ </span>
238
+ <span className="sr-only">(required)</span>
239
+ </label>
240
+ <input
241
+ id="email"
242
+ name="email"
243
+ type="email"
244
+ required
245
+ aria-required="true"
246
+ aria-invalid={!!errors.email}
247
+ aria-describedby={errors.email ? "email-error" : "email-hint"}
248
+ className={cn(
249
+ "w-full px-3 py-2 border rounded-md",
250
+ errors.email && "border-destructive",
251
+ )}
252
+ />
253
+ {errors.email ? (
254
+ <p id="email-error" className="text-sm text-destructive" role="alert">
255
+ {errors.email}
256
+ </p>
257
+ ) : (
258
+ <p id="email-hint" className="text-sm text-muted-foreground">
259
+ We'll never share your email.
260
+ </p>
261
+ )}
262
+ </div>
263
+
264
+ <button type="submit" className="mt-4">
265
+ Submit
266
+ </button>
267
+ </form>
268
+ );
269
+ }
270
+ ```
271
+
272
+ ### Pattern 4: Skip Navigation Link
273
+
274
+ ```tsx
275
+ function SkipLink() {
276
+ return (
277
+ <a
278
+ href="#main-content"
279
+ className={cn(
280
+ // Hidden by default, visible on focus
281
+ "sr-only focus:not-sr-only",
282
+ "focus:absolute focus:top-4 focus:left-4 focus:z-50",
283
+ "focus:bg-background focus:px-4 focus:py-2 focus:rounded-md",
284
+ "focus:ring-2 focus:ring-primary",
285
+ )}
286
+ >
287
+ Skip to main content
288
+ </a>
289
+ );
290
+ }
291
+
292
+ // In layout
293
+ function Layout({ children }) {
294
+ return (
295
+ <>
296
+ <SkipLink />
297
+ <header>...</header>
298
+ <nav aria-label="Main navigation">...</nav>
299
+ <main id="main-content" tabIndex={-1}>
300
+ {children}
301
+ </main>
302
+ <footer>...</footer>
303
+ </>
304
+ );
305
+ }
306
+ ```
307
+
308
+ ### Pattern 5: Live Region for Announcements
309
+
310
+ ```tsx
311
+ function useAnnounce() {
312
+ const [message, setMessage] = React.useState("");
313
+
314
+ const announce = React.useCallback(
315
+ (text: string, priority: "polite" | "assertive" = "polite") => {
316
+ setMessage(""); // Clear first to ensure re-announcement
317
+ setTimeout(() => setMessage(text), 100);
318
+ },
319
+ [],
320
+ );
321
+
322
+ const Announcer = () => (
323
+ <div
324
+ role="status"
325
+ aria-live="polite"
326
+ aria-atomic="true"
327
+ className="sr-only"
328
+ >
329
+ {message}
330
+ </div>
331
+ );
332
+
333
+ return { announce, Announcer };
334
+ }
335
+
336
+ // Usage
337
+ function SearchResults({ results, isLoading }) {
338
+ const { announce, Announcer } = useAnnounce();
339
+
340
+ React.useEffect(() => {
341
+ if (!isLoading && results) {
342
+ announce(`${results.length} results found`);
343
+ }
344
+ }, [results, isLoading, announce]);
345
+
346
+ return (
347
+ <>
348
+ <Announcer />
349
+ <ul>{/* results */}</ul>
350
+ </>
351
+ );
352
+ }
353
+ ```
354
+
355
+ ## Color Contrast Requirements
356
+
357
+ ```typescript
358
+ // Contrast ratio utilities
359
+ function getContrastRatio(foreground: string, background: string): number {
360
+ const fgLuminance = getLuminance(foreground);
361
+ const bgLuminance = getLuminance(background);
362
+ const lighter = Math.max(fgLuminance, bgLuminance);
363
+ const darker = Math.min(fgLuminance, bgLuminance);
364
+ return (lighter + 0.05) / (darker + 0.05);
365
+ }
366
+
367
+ // WCAG requirements
368
+ const CONTRAST_REQUIREMENTS = {
369
+ // Normal text (<18pt or <14pt bold)
370
+ normalText: {
371
+ AA: 4.5,
372
+ AAA: 7,
373
+ },
374
+ // Large text (>=18pt or >=14pt bold)
375
+ largeText: {
376
+ AA: 3,
377
+ AAA: 4.5,
378
+ },
379
+ // UI components and graphics
380
+ uiComponents: {
381
+ AA: 3,
382
+ },
383
+ };
384
+ ```
385
+
386
+ ## Best Practices
387
+
388
+ 1. **Use Semantic HTML**: Prefer native elements over ARIA when possible
389
+ 2. **Test with Real Users**: Include people with disabilities in user testing
390
+ 3. **Keyboard First**: Design interactions to work without a mouse
391
+ 4. **Don't Disable Focus Styles**: Style them, don't remove them
392
+ 5. **Provide Text Alternatives**: All non-text content needs descriptions
393
+ 6. **Support Zoom**: Content should work at 200% zoom
394
+ 7. **Announce Changes**: Use live regions for dynamic content
395
+ 8. **Respect Preferences**: Honor prefers-reduced-motion and prefers-contrast
396
+
397
+ ## Common Issues
398
+
399
+ - **Missing alt text**: Images without descriptions
400
+ - **Poor color contrast**: Text hard to read against background
401
+ - **Keyboard traps**: Focus stuck in component
402
+ - **Missing labels**: Form inputs without associated labels
403
+ - **Auto-playing media**: Content that plays without user initiation
404
+ - **Inaccessible custom controls**: Recreating native functionality poorly
405
+ - **Missing skip links**: No way to bypass repetitive content
406
+ - **Focus order issues**: Tab order doesn't match visual order
407
+
408
+ ## Testing Tools
409
+
410
+ - **Automated**: axe DevTools, WAVE, Lighthouse
411
+ - **Manual**: VoiceOver (macOS/iOS), NVDA/JAWS (Windows), TalkBack (Android)
412
+ - **Simulators**: NoCoffee (vision), Silktide (various disabilities)
413
+
414
+ ## Resources
415
+
416
+ - [WCAG 2.2 Guidelines](https://www.w3.org/WAI/WCAG22/quickref/)
417
+ - [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
418
+ - [A11y Project Checklist](https://www.a11yproject.com/checklist/)
419
+ - [Inclusive Components](https://inclusive-components.design/)
420
+ - [Deque University](https://dequeuniversity.com/)