Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA
git clone https://github.com/affaan-m/ECC.git--- name: accessibility description: Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA standards. Use this skill to generate semantic ARIA for Web and accessibility traits for Web and Native platforms (iOS/Android). metadata: origin: ECC --- # Accessibility (WCAG 2.2) This skill ensures that digital interfaces are Perceivable, Operable, Understandable, and Robust (POUR) for all users, including those using screen readers, switch controls, or keyboard navigation. It focuses on the technical implementation of WCAG 2.2 success criteria. ## When to Use - Defining UI component specifications for Web, iOS, or Android. - Auditing existing code for accessibility barriers or compliance gaps. - Implementing new WCAG 2.2 standards like Target Size (Minimum) and Focus Appearance. - Mapping high-level design requirements to technical attributes (ARIA roles, traits, hints). ## Core Concepts - **POUR Principles**: The foundation of WCAG (Perceivable, Operable, Understandable, Robust). - **Semantic Mapping**: Using native elements over generic containers to provide built-in accessibility. - **Accessibility Tree**: The representation of the UI that assistive technologies actually "read." - **Focus Management**: Controlling the order and visibility of the keyboard/screen reader cursor. - **Labeling & Hints**: Providing context through `aria-label`, `accessibilityLabel`, and `contentDescription`. ## How It Works ### Step 1: Identify the Component Role Determine the functional purpose (e.g., Is this a button, a link, or a tab?). Use the most semantic native element available before resorting to custom roles. ### Step 2: Define Perceivable Attributes - Ensure text contrast meets **4.5:1** (normal) or **3:1** (large/UI). - Add text alternatives for non-text content (images, icons). - Implement responsive reflow (up to 400% zoom without loss of function). ### Step 3: Implement Operable Controls - Ensure a minimum **24x24 CSS pixel** target size (WCAG 2.2 SC 2.5.8). - Verify all interactive elements are reachable via keyboard and have a visible focus indicator (SC 2.4.11). - Provide single-pointer alternatives for dragging movements. ### Step 4: Ensure Understandable Logic - Use consistent navigation patterns. - Provide descriptive error messages and suggestions for correction (SC 3.3.3). - Implement "Redundant Entry" (SC 3.3.7) to prevent asking for the same data twice. ### Step 5: Verify Robust Compatibility - Use correct `Name, Role, Value` patterns. - Implement `aria-live` or live regions for dynamic status updates. ## Accessibility Architecture Diagram ```mermaid flowchart TD UI["UI Component"] --> Platform{Platform?} Platform -->|Web| ARIA["WAI-ARIA + HTML5"] Platform -->|iOS| SwiftUI["Accessibility Traits + Labels"] Platform -->|Android| Compose["Semantics + ContentDesc"] ARIA --> AT["Assistive Technology (Screen Readers, Switches)"] SwiftUI --> AT Compose --> AT ``` ## Cross-Platform Mapping | Feature | Web (HTML/ARIA) | iOS (SwiftUI) | Android (Compose) | | :----------------- | :----------------------- | :----------------------------------- | :---------------------------------------------------------- | | **Primary Label** | `aria-label` / `<label>` | `.accessibilityLabel()` | `contentDescription` | | **Secondary Hint** | `aria-describedby` | `.accessibilityHint()` | `Modifier.semantics { stateDescription = ... }` | | **Action Role** | `role="button"` | `.accessibilityAddTraits(.isButton)` | `Modifier.semantics { role = Role.Button }` | | **Live Updates** | `aria-live="polite"` | `.accessibilityLiveRegion(.polite)` | `Modifier.semantics { liveRegion = LiveRegionMode.Polite }` | ## Examples ### Web: Accessible Search ```html <form role="search"> <label for="search-input" class="sr-only">Search products</label> <input type="search" id="search-input" placeholder="Search..." /> <button type="submit" aria-label="Submit Search"> <svg aria-hidden="true">...</svg> </button> </form> ``` ### iOS: Accessible Action Button ```swift Button(action: deleteItem) { Image(systemName: "trash") } .accessibilityLabel("Delete item") .accessibilityHint("Permanently removes this item from your list") .accessibilityAddTraits(.isButton) ``` ### Android: Accessible Toggle ```kotlin Switch( checked = isEnabled, onCheckedChange = { onToggle() }, modifier = Modifier.semantics { contentDescription = "Enable notifications" } ) ``` ## Anti-Patterns to Avoid - **Div-Buttons**: Using a `<div>` or `<span>` for a click event without adding a role and keyboard support. - **Color-Only Meaning**: Indicating an error or status _only_ with a color change (e.g., turning a border red). - **Uncontained Modal Focus**: Modals that don't trap focus, allowing keyboard users to navigate background content while the modal is open. Focus must be contained _and_ escapable via the `Escape` key or an explicit close button (WCAG SC 2.1.2). - **Redundant Alt Text**: Using "Image of..." or "Picture of..." in alt text (screen readers already announce the role "Image"). ## Best Practices Checklist - [ ] Interactive elements meet the **24x24px** (Web) or **44x44pt** (Native) target size. - [ ] Focus indicators are clearly visible and high-contrast. - [ ] Modals **contain focus** while open, and release it cleanly on close (`Escape` key or close button). - [ ] Dropdowns and menus restore focus to the trigger element on close. - [ ] Forms provide text-based error suggestions. - [ ] All icon-only buttons have a descriptive text label. - [ ] Content reflows properly when text is scaled. ## References - [WCAG 2.2 Guidelines](https://www.w3.org/TR/WCAG22/) - [WAI-ARIA Authoring Practices](https://www.w3.org/TR/wai-aria-practices/) - [iOS Accessibility Programming Guide](https://developer.apple.com/documentation/accessibility) - [iOS Human Interface Guidelines - Accessibility](https://developer.apple.com/design/human-interface-guidelines/accessibility) - [Android Accessibility Developer Guide](https://developer.android.com/guide/topics/ui/accessibility) ## Related Skills - `frontend-patterns` - `design-system` - `liquid-glass-design` - `swiftui-patterns`
[{"step":"Define the scope and WCAG criteria","action":"Specify whether you're auditing a website, mobile app, or document, and whether you need WCAG 2.1 or 2.2 Level AA compliance. Include any specific user groups (e.g., screen reader users, keyboard-only users) or technologies (e.g., React, iOS).","tip":"Use the prompt template to customize the scope. For example, replace [WEBSITE/APPLICATION] with 'AcmeCorp’s checkout flow' and [SCOPE] with 'keyboard operability and screen reader compatibility'."},{"step":"Gather tools and resources","action":"Collect URLs, code repositories, design files (Figma/Adobe XD), and any existing accessibility documentation. Install automated testing tools like axe-core, WAVE, or Lighthouse for initial scans.","tip":"For web apps, use browser extensions like axe DevTools or WAVE to quickly identify low-hanging fruit. For mobile apps, use tools like Android Accessibility Scanner or Xcode’s Accessibility Inspector."},{"step":"Run the audit","action":"Use the prompt template to generate a detailed report. Manually test critical user flows (e.g., sign-up, checkout) with screen readers (NVDA, VoiceOver, JAWS) and keyboard-only navigation. Cross-reference findings with WCAG 2.2 guidelines.","tip":"Prioritize issues based on severity (P0/P1/P2) and impact on users. Focus on issues that block core functionality first."},{"step":"Generate a remediation plan","action":"Use the prompt to create a prioritized roadmap with estimated effort, responsible teams, and deadlines. Include code snippets or design mockups for complex fixes.","tip":"Break down large fixes into smaller tasks. For example, 'Fix color contrast' might involve updating 10 buttons across the site—assign this to a developer and a designer."},{"step":"Integrate accessibility into workflows","action":"Set up automated testing in your CI/CD pipeline (e.g., axe-core in GitHub Actions) and schedule regular audits (e.g., monthly). Train your team on WCAG principles and accessibility best practices.","tip":"Start with automated tools to catch regressions, but supplement with manual testing for nuanced issues like keyboard traps or ARIA misuse."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/affaan-m/ECC/tree/main/skills/accessibilityCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as an accessibility expert and review the [WEBSITE/APPLICATION] for WCAG 2.2 Level AA compliance. Focus on [SCOPE: e.g., navigation, forms, color contrast, screen reader compatibility, keyboard operability]. Provide a prioritized list of issues with: 1) the specific WCAG success criterion violated, 2) the exact location in the code/UI, 3) a clear explanation of the impact on users with disabilities, and 4) actionable remediation steps. Include code snippets or screenshots where helpful. After the audit, generate a remediation roadmap with estimated effort (hours/days) and responsible teams (e.g., developers, designers, content). Finally, suggest automated testing tools (e.g., axe-core, WAVE) to integrate into the CI/CD pipeline for ongoing compliance.
### Accessibility Audit Report: AcmeCorp Website (Homepage) - WCAG 2.2 Level AA Compliance
**Summary:** The audit identified 12 critical issues, 8 moderate issues, and 5 minor issues affecting users with disabilities. The most severe issues involve keyboard navigation and color contrast, which prevent users with motor impairments and low vision from completing key tasks like account creation or checkout.
#### Critical Issues (P0 - Fix Immediately):
1. **Keyboard Trap (WCAG 2.2.1 - No Keyboard Trap)**
- **Location:** Login modal (id: `login-modal`).
- **Issue:** After opening the modal, users cannot close it using the keyboard (Tab/Shift+Tab cycles focus but does not exit the modal).
- **Impact:** Users relying on keyboard navigation cannot proceed or exit the modal, violating WCAG 2.2.1.
- **Remediation:** Add `ESC` key support to close the modal and ensure focus is returned to the triggering button. Example fix:
```javascript
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && modal.isOpen) {
modal.close();
triggerButton.focus();
}
});
```
- **Effort:** 2 hours (developer).
2. **Insufficient Color Contrast (WCAG 1.4.3 - Contrast Minimum)**
- **Location:** Primary button (class: `btn-primary`) on the homepage hero section.
- **Issue:** Text color `#4A90E2` on background `#F8F9FA` has a contrast ratio of 2.8:1 (fails 4.5:1 requirement).
- **Impact:** Users with low vision or color blindness cannot read the button text.
- **Remediation:** Change button text color to `#0056B3` (contrast ratio: 7.1:1).
- **Effort:** 1 hour (designer + developer).
#### Moderate Issues (P1 - Fix Within 2 Weeks):
1. **Missing ARIA Labels (WCAG 4.1.2 - Name, Role, Value)**
- **Location:** Search input field (id: `search-input`).
- **Issue:** No `aria-label` or `aria-labelledby` attribute for screen readers.
- **Impact:** Screen reader users cannot understand the purpose of the field.
- **Remediation:** Add `aria-label="Search products"` to the input.
- **Effort:** 30 minutes (developer).
2. **Non-Descriptive Link Text (WCAG 2.4.4 - Link Purpose)**
- **Location:** Footer links (class: `footer-link`).
- **Issue:** Links like "Click here" and "Learn more" lack context.
- **Impact:** Screen reader users cannot understand where links lead.
- **Remediation:** Update text to "Read our Privacy Policy" or "Contact Support."
- **Effort:** 1 hour (content team).
#### Automated Testing Recommendations:
- **axe-core:** Integrate into Jest/Playwright tests to catch regressions. Example:
```javascript
const axe = require('axe-core');
await axe.run(); // Add to test suite
```
- **WAVE:** Use for quick manual checks during development.
#### Remediation Roadmap:
| Priority | Issue | Owner | Estimated Time | Deadline |
|----------|-------|-------|----------------|----------|
| P0 | Keyboard Trap | Frontend Dev | 2 hours | 2023-11-15 |
| P0 | Color Contrast | Designer + Dev | 1 hour | 2023-11-15 |
| P1 | ARIA Labels | Frontend Dev | 30 mins | 2023-11-22 |
| P1 | Link Text | Content Team | 1 hour | 2023-11-22 |
**Next Steps:**
1. Share this report with the frontend team and assign P0 issues first.
2. Schedule a workshop to train the team on WCAG 2.2 principles.
3. Set up automated testing in the CI pipeline to prevent regressions.
**Tools Used:** WAVE (initial scan), axe-core (automated checks), NVDA (screen reader testing).
--- *Note: This report is based on a manual audit of the homepage. A full site audit would require additional testing.*skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan