common-accessibility
Enforce WCAG 2.2 AA compliance with semantic HTML, ARIA roles, keyboard navigation, and color contrast standards for web UIs. Use when building interactive components, adding form labels, fixing focus traps, or auditing a11y compliance.
What this skill does
# Common Accessibility (a11y) Standards ## **Priority: P1 (OPERATIONAL)** > Legal req: EU (Web Accessibility Directive), USA (ADA/Section 508). Non-compliance = litigation risk. Minimum: **WCAG 2.2 Level AA**. ## ๐ Semantic HTML First - Use native HTML before ARIA. `<button>`, `<a>`, `<nav>`, `<main>`, `<section>`, `<form>`, `<label>` convey semantics natively. - Never `<div>`/`<span>` for interactive elements โ no keyboard role by default. - Headings (`h1`โ`h6`) must form logical outline. One `h1` per page. - `<button>` not `<div onClick>`, `<a>` not `<span onClick>`. ## ๐ญ ARIA โ Use Sparingly ARIA supplements native HTML when insufficient (e.g., custom widgets). Rules: 1. **No ARIA > Bad ARIA**: If native HTML works, use it. ARIA only adds roles, not behavior. 2. **Required attributes**: Every `role` with required properties must include them (e.g., `role="slider"` needs `aria-valuenow`, `aria-valuemin`, `aria-valuemax`). 3. **Live Regions**: Use `aria-live="polite"` for status messages; `aria-live="assertive"` only for critical alerts. 4. **Labels**: Every form control needs programmatic label (`<label>`, `aria-label`, or `aria-labelledby`). 5. **Hidden content**: Use `aria-hidden="true"` on decorative icons; never on focusable elements. ## โจ๏ธ Keyboard Navigation - All interactive elements MUST reachable and operable via keyboard. - Tab order must follow visual reading order. No positive `tabindex` (`tabindex="1"` breaks natural order). - Visible focus indicators required (see Focus style rule below). - **Modals/Dialogs**: Trap focus inside when open. Return focus to trigger element on close. - **Escape key**: Must close modals, dropdowns, and tooltips. - **Focus style**: Never `outline: none` without visible replacement (min 2px solid, 3:1 contrast). ## ๐จ Color & Contrast - Normal text: โฅ 4.5:1 ratio. Large text (โฅ 18pt or 14pt bold): โฅ 3:1. UI components: โฅ 3:1. - Never convey information through color alone โ add icon, pattern, or text label. - Test with: axe DevTools, WAVE, Lighthouse. ## ๐ Touch & Pointer Targets - Minimum interactive target size: **44ร44px** (WCAG 2.5.5 AAA) / **24ร24px** minimum (WCAG 2.2 AA). - Sufficient spacing between adjacent targets โ prevent mis-taps. ## ๐ผ Images & Media - Decorative images: `alt="` (empty, not missing). - Informative images: descriptive `alt` โ what image conveys, not "image ofโฆ". - Complex charts/graphs: text summary or data table alternative. - Video: Captions mandatory. Audio descriptions for visual-only content. ## ๐งช Testing Minimum - CI gate: `axe-core` zero critical violations. - Manual: keyboard-only full flow + screen reader (NVDA/VoiceOver) + 200% zoom. ## Anti-Patterns - **No `onClick` on `<div>`**: Use `<button>` or add `role`, `tabindex`, and keyboard handlers. - **No missing `alt`**: Every `<img>` must `alt` attribute (empty string if decorative). - **No color-only status**: Red = error must also show icon or text. - **No `outline: none`** without replacement focus style. - **No auto-playing media**: Users with vestibular disorders may harmed. - **No dynamic content without announcement**: Use `aria-live` for async status updates. ## References - [Semantic HTML, ARIA & Focus Patterns](references/REFERENCE.md) - [WCAG 2.2 Quick Reference](https://www.w3.org/WAI/WCAG22/quickref/) - [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/) - [axe-core Rules](https://dequeuniversity.com/rules/axe/)
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4โv5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.