Imagine you are building a temple in Ancient Egypt. Would you want only a select group of people to visit it, or rather everyone - from the pharaoh to an ordinary fisherman? Web accessibility (accessibility, abbreviated as a11y) is the idea that every user - regardless of their abilities - should have equal access to content on the internet.
Approximately 15% of the world's population lives with some form of disability. That is over a billion people! These can include:
Accessibility is not just an ethical obligation - it is also a legal requirement in many countries (e.g., the European Accessibility Act in the EU).
WCAG (Web Content Accessibility Guidelines) is an international standard created by W3C. It is based on four pillars that can be remembered by the acronym POUR:
Content must be presented in a way that is accessible to the user's senses.
1<!-- BAD - no alt text -->
2<img src="pyramid.jpg">
3
4<!-- GOOD - description for screen readers -->
5<img src="pyramid.jpg" alt="The Great Pyramid of Giza at sunset">The interface must be operable through various navigation methods.
1<!-- Button accessible via keyboard -->
2<button onclick="openMenu()">Open menu</button>
3
4<!-- Link with visible focus -->
5<a href="/contact" class="nav-link">Contact</a>Content and interface must be understandable for users.
1<!-- Specifying page language -->
2<html lang="en">
3
4<!-- Readable form labels -->
5<label for="email">Email address:</label>
6<input type="email" id="email" name="email">Content must be compatible with various assistive technologies.
1<!-- Correct HTML structure -->
2<!DOCTYPE html>
3<html lang="en">
4<head>
5 <meta charset="UTF-8">
6 <title>Egyptian Museum</title>
7</head>
8<body>
9 <header>
10 <nav>...</nav>
11 </header>
12 <main>...</main>
13 <footer>...</footer>
14</body>
15</html>WCAG defines three conformance levels:
Most legal regulations require AA level.
The most important rules to start with:
<nav>, <main>, <article> instead of just <div>alt attribute for images<label> associated with <input>Just as the ancient Egyptians designed temples accessible to all pilgrims, so should we create pages accessible to all internet users.