Accessibility

Accessibility Standards

Detailed WCAG requirements and implementation guidelines

Draft

Detailed requirements for WCAG compliance with Tailwind CSS implementation patterns.

Focus Indicators

RequirementWCAGTailwind
Visible focus ring2.4.7focus:ring-2 focus:ring-offset-2 focus:ring-primary-500
Focus visible only2.4.7focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500
Focus within-focus-within:ring-2
Skip to content2.4.1sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4
<!-- Recommended focus pattern -->
<button class="focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500">
  Action
</button>

<!-- Skip to content link -->
<a href="#main" class="sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-white focus:text-primary-500">
  Skip to content
</a>

Color Contrast

RequirementMinimum RatioWCAG Level
Normal text (<18px)4.5:1AA
Large text (>=18px or 14px bold)3.0:1AA
UI components3.0:1AA
Enhanced (critical content)7.0:1AAA

Touch Targets

SizeValueTailwind
Minimum44pxmin-h-11 min-w-11
Recommended48pxmin-h-12 min-w-12
<!-- Touch-friendly button -->
<button class="min-h-11 min-w-11 px-4 py-2">Tap me</button>

<!-- Comfortable touch target -->
<button class="min-h-12 min-w-12 px-4 py-2">Tap me</button>

Screen Reader Support

PatternTailwindUse Case
Visually hiddensr-onlyHide text visually, keep for screen readers
Show on focusnot-sr-onlyReveal hidden content on focus
Skip linksr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4Skip navigation pattern
<!-- Screen reader only text -->
<span class="sr-only">Close dialog</span>

<!-- Icon button with accessible label -->
<button aria-label="Close">
  <svg class="w-5 h-5">...</svg>
</button>

Keyboard Accessibility

  • No keyboard traps
  • Shortcut keys can be disabled
  • Focus order is logical

Motion and Animation

PatternTailwindDescription
Safe animationsmotion-safe:animate-spin motion-safe:transition-allOnly animate when user allows
Reduce animationsmotion-reduce:animate-none motion-reduce:transition-noneRemove animation for sensitive users
<!-- Accessible animation -->
<div class="motion-safe:transition-all motion-safe:duration-300
            motion-reduce:transition-none">
  Animated content
</div>

<!-- Loading spinner with reduced motion fallback -->
<svg class="motion-safe:animate-spin motion-reduce:animate-none w-5 h-5">
  ...
</svg>

Forms and Inputs

Labels:

  • Every input has a visible label
  • Labels positioned consistently (above or left)
  • Don't rely on placeholder text alone
  • Group related fields with fieldset/legend

Errors:

  • Identify errors clearly
  • Describe what's wrong
  • Suggest how to fix
  • Focus moves to first error
  • Errors announced to screen readers

Required fields:

  • Mark required fields clearly
  • Use 'required' text, not just asterisk
  • Explain required marker at form start

Content Guidelines

  • Plain language: Aim for 8th grade reading level
  • Consistent navigation: Same structure across pages
  • Clear error messages: Describe error + how to fix
  • Meaningful alt text: Describe content and purpose