principleMajorpending
Principle: Accessibility is not optional
Viewed 0 times
accessibilitya11yWCAGscreen-readerkeyboardsemantic-HTML
Problem
Web applications built without accessibility considerations exclude users with disabilities and often violate legal requirements.
Solution
Core accessibility practices:
<button> not <div onclick> (keyboard accessible)
<nav>, <main>, <aside> (screen reader navigation)
<label for="id"> (form field identification)
<h1>-<h6> in order (document structure)
- All interactive elements focusable (Tab/Shift+Tab)
- Visible focus indicators (never outline: none without alternative)
- Escape closes modals/dropdowns
- Arrow keys for menus/tabs
- Alt text on images (alt="" for decorative)
- aria-label for icon-only buttons
- aria-live for dynamic content updates
- Don't use aria if HTML semantics suffice
- Color contrast ratio 4.5:1 minimum (WCAG AA)
- Don't convey info by color alone
- Support 200% zoom without breaking layout
- Respect prefers-reduced-motion
- Tab through every page (can you use it without a mouse?)
- Run axe DevTools or Lighthouse accessibility audit
- Test with screen reader (VoiceOver on Mac, NVDA on Windows)
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.01ms !important; }
}
- Semantic HTML (biggest impact, least effort):
<button> not <div onclick> (keyboard accessible)
<nav>, <main>, <aside> (screen reader navigation)
<label for="id"> (form field identification)
<h1>-<h6> in order (document structure)
- Keyboard navigation:
- All interactive elements focusable (Tab/Shift+Tab)
- Visible focus indicators (never outline: none without alternative)
- Escape closes modals/dropdowns
- Arrow keys for menus/tabs
- Screen readers:
- Alt text on images (alt="" for decorative)
- aria-label for icon-only buttons
- aria-live for dynamic content updates
- Don't use aria if HTML semantics suffice
- Visual:
- Color contrast ratio 4.5:1 minimum (WCAG AA)
- Don't convey info by color alone
- Support 200% zoom without breaking layout
- Respect prefers-reduced-motion
- Testing:
- Tab through every page (can you use it without a mouse?)
- Run axe DevTools or Lighthouse accessibility audit
- Test with screen reader (VoiceOver on Mac, NVDA on Windows)
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.01ms !important; }
}
Why
15-20% of people have some form of disability. Accessible sites also work better for everyone (keyboard power users, mobile, SEO).
Revisions (0)
No revisions yet.