# Accessibility Guidelines WCAG 2.1 Level AA compliance checklist and best practices for web design. ## Color & Contrast ### Text Contrast Requirements **Normal text (< 18px or < 14px bold):** - Minimum contrast ratio: 4.5:1 against background - Example: #18181b text on #ffffff = 19.56:1 ✓ - Example: #71717a text on #fafafa = 2.8:1 ✗ **Large text (≥ 18px or ≥ 14px bold):** - Minimum contrast ratio: 3:1 against background - Recommended: Still aim for 4.5:1 when possible **UI Components & Graphics:** - Interactive elements: 3:1 against adjacent colors - Graphs, charts, icons: 3:1 minimum - Focus indicators: 3:1 against background ### Tools for Testing Use these tools to verify contrast: - WebAIM Contrast Checker - Chrome DevTools Lighthouse - Stark plugin (Figma/Sketch) - Contrast Analyzer (desktop app) ### Common Issues **Insufficient contrast:** - Light gray text on white (#aaa on #fff = 2.3:1) - Placeholder text often fails (many browsers use low contrast) - Disabled states (okay to have lower contrast, but clearly indicate disabled) **Good practices:** - Text on images: Add overlay or shadow for contrast - Links: Underline or sufficient contrast difference - Buttons: Ensure text contrasts with background ## Semantic HTML ### Use Appropriate Elements **Navigation:** ```html ``` **Main content:** ```html

Page Title

Content...

``` **Complementary content:** ```html ``` **Page sections:** ```html

Section Title

``` **Buttons vs Links:** - ` ``` ### ARIA Labels **Form inputs:** ```html ``` **Buttons:** ```html ``` **Navigation landmarks:** ```html ``` ### Live Regions **Dynamic content updates:** ```html

5 new messages

Error: Failed to save changes

Saving...

``` **Loading states:** ```html ``` ## Forms ### Labels & Instructions **Every input needs a label:** ```html ``` **Required fields:** ```html ``` **Helper text:** ```html
Must be at least 8 characters
``` ### Error Handling **Validation errors:** ```html ``` **Error summary:** ```html

There are 2 errors in this form

``` ### Fieldsets & Groups **Related inputs:** ```html
Shipping Address
``` **Radio button groups:** ```html
Select your plan
``` ## Interactive Components ### Buttons **Button requirements:** - Minimum size: 44x44px (iOS guideline) - Clear focus indicator - Disabled state clearly visible - Loading state announced to screen readers ```html ``` ### Modals/Dialogs **Modal requirements:** - Focus trap (keep focus inside modal) - Close with Escape key - Return focus to trigger element on close - Screen readers announce modal opening ```html

Confirm Action

Are you sure you want to delete this item?

``` ### Dropdowns/Menus **Menu button pattern:** ```html ``` ### Tabs **Tab pattern:** ```html
Overview content...
``` ## Mobile & Touch ### Touch Targets **Minimum sizes:** - 44x44px on iOS (Apple guideline) - 48x48px on Android (Material Design) - Use larger targets for primary actions **Spacing:** - 8px minimum between touch targets - More spacing for dense interfaces ### Viewport & Zoom **Allow zoom:** ```html ``` **Responsive text:** - Use relative units (rem, em) - Don't set maximum font size - Ensure text reflows at 200% zoom ## Testing Checklist ### Automated Testing - [ ] Run Lighthouse accessibility audit - [ ] Check WAVE browser extension - [ ] Validate HTML (W3C validator) - [ ] Test color contrast (WebAIM checker) ### Manual Testing - [ ] Navigate entire site using only keyboard - [ ] Test with screen reader (NVDA, JAWS, VoiceOver) - [ ] Zoom to 200% and verify layout - [ ] Test with browser extensions disabled - [ ] Test on mobile device - [ ] Test with reduced motion settings - [ ] Test in high contrast mode ### Specific Checks - [ ] All images have alt text - [ ] Forms have proper labels - [ ] Focus indicators are visible - [ ] Color is not only method of conveying info - [ ] Text has sufficient contrast - [ ] Headings are properly nested - [ ] Links have descriptive text - [ ] Videos have captions - [ ] Audio has transcripts - [ ] Tables have proper headers - [ ] Interactive elements are keyboard accessible - [ ] Error messages are clear and helpful - [ ] Loading states are announced - [ ] Modals trap focus and close with Escape ## Common Mistakes **Don't:** - Use `
` or `` as buttons (use `