---
name: accessibility-wcag
description: WCAG 2.1 AA compliance requirements including semantic markup, keyboard navigation, ARIA labels, and color contrast
license: Apache-2.0
---
# Accessibility WCAG Skill
## Purpose
This skill ensures all web content meets WCAG 2.1 Level AA standards for accessibility, making websites usable by people with disabilities including visual, auditory, motor, and cognitive impairments.
## Rules
### WCAG 2.1 AA Requirements
WCAG is organized around four principles (POUR):
1. **Perceivable** - Information must be presentable in ways users can perceive
2. **Operable** - Interface must be operable by all users
3. **Understandable** - Information and operation must be understandable
4. **Robust** - Content must be robust enough for assistive technologies
### Perceivable Requirements
#### Text Alternatives (1.1)
**MUST:**
- Provide `alt` text for all meaningful images
- Use empty `alt=""` for decorative images
- Provide captions for audio/video content
- Provide transcripts for audio-only content
- Use descriptive link text (not "click here")
**Examples:**
```html
```
#### Time-based Media (1.2)
**MUST:**
- Provide captions for videos (prerecorded and live)
- Provide audio descriptions for video content
- Provide transcripts for audio content
#### Adaptable Content (1.3)
**MUST:**
- Use semantic HTML (headings, lists, tables correctly)
- Ensure content is accessible without CSS
- Don't rely on sensory characteristics alone (color, shape, position)
- Use proper reading order in DOM
**Examples:**
```html
```
#### Distinguishable Content (1.4)
**MUST:**
- Maintain color contrast ratio of at least 4.5:1 for normal text
- Maintain color contrast ratio of at least 3:1 for large text (18pt+ or 14pt+ bold)
- Don't use color alone to convey information
- Allow text resize up to 200% without loss of functionality
- Avoid background audio that can't be paused/stopped
- Ensure text can be selected and copied
**Color Contrast Examples:**
```css
/* GOOD: High contrast (7:1) */
.text {
color: #000000; /* Black */
background-color: #FFFFFF; /* White */
}
/* GOOD: Sufficient contrast (4.6:1) */
.link {
color: #0066CC; /* Blue */
background-color: #FFFFFF; /* White */
}
/* BAD: Insufficient contrast (2.3:1) */
.subtle-text {
color: #CCCCCC; /* Light gray */
background-color: #FFFFFF; /* White */
}
```
### Operable Requirements
#### Keyboard Accessible (2.1)
**MUST:**
- Make all functionality available via keyboard
- Provide visible focus indicators
- Don't create keyboard traps
- Ensure logical tab order
- Provide keyboard shortcuts for complex interfaces
**Examples:**
```html
Submit
Submit
```
```css
/* GOOD: Visible focus indicator */
a:focus,
button:focus {
outline: 2px solid #0066CC;
outline-offset: 2px;
}
/* BAD: Removing focus outline without replacement */
*:focus {
outline: none; /* Never do this without providing alternative! */
}
```
#### Enough Time (2.2)
**MUST:**
- Allow users to turn off, adjust, or extend time limits
- Provide pause, stop, hide for auto-updating content
- No time limits unless essential (auctions, real-time games)
#### Seizures and Physical Reactions (2.3)
**MUST NOT:**
- Use content that flashes more than 3 times per second
- Create large flashing areas
#### Navigable (2.4)
**MUST:**
- Provide skip links to bypass repeated content
- Use descriptive page titles
- Ensure logical focus order
- Provide clear link purposes
- Offer multiple ways to navigate (menu, search, sitemap)
- Provide visible focus indicators
- Use clear headings and labels
**Examples:**
```html
Skip to main content...Security Services - ISO 27001 Implementation | Hack23Services
```
#### Input Modalities (2.5)
**MUST:**
- Ensure touch targets are at least 44×44 pixels
- Don't rely on device motion alone
- Allow cancellation of pointer events
- Make clickable label text match accessible name
### Understandable Requirements
#### Readable (3.1)
**MUST:**
- Specify language of page with `lang` attribute
- Specify language of passages that differ from page language
- Keep content at appropriate reading level (when possible)
**Examples:**
```html
The phrase je ne sais quoi is French.
```
#### Predictable (3.2)
**MUST:**
- Don't change context on focus
- Don't change context on input (without warning)
- Use consistent navigation across pages
- Use consistent identification of components
#### Input Assistance (3.3)
**MUST:**
- Identify input errors clearly
- Provide labels or instructions for user input
- Provide error suggestions when possible
- Prevent errors in legal/financial transactions
- Allow review/confirmation before final submission
**Examples:**
```html
Please enter a valid email address (e.g., name@example.com)
```
### Robust Requirements
#### Compatible (4.1)
**MUST:**
- Ensure HTML is valid (no duplicate IDs, proper nesting)
- Use ARIA correctly (roles, states, properties)
- Provide name, role, value for all UI components
- Ensure status messages can be programmatically determined
**ARIA Examples:**
```html
Changes saved successfully
```
## ARIA Best Practices
**Use ARIA When:**
- Native HTML element doesn't exist for your component
- Need to enhance semantic meaning
- Need to communicate state or property not available in HTML
**ARIA Landmarks:**
```html