In Part 1, we explored the basics of accessibility and how to create a solid semantic HTML foundation. Now, letβs move forward by identifying and fixing the most common accessibility problems that appear on real-world websites.
These small fixes can drastically improve usability and compliance with WCAG Level A and AA standards.
πΌοΈ 1. Missing or Inaccurate Alt Text for Images
Images must include meaningful alternative text (alt) to describe their purpose to screen readers and assistive tools.
β Common Problems
- Missing
altattribute - Decorative images without
alt="" - Redundant alt text (e.g., same as caption or nearby text)
β Best Practices
- Describe the function of the image, not the appearance.
- If an image is purely decorative, use
alt=""to hide it from screen readers. - Don't duplicate nearby content.
π§ͺ Example
<!-- Bad: missing alt -->
<img src="search-icon.png">
<!-- Good: functional alt -->
<img src="search-icon.png" alt="Search">
<!-- Decorative image -->
<img src="divider.png" alt="">
π οΈ Tool Tip: Use WAVE to detect missing or redundant alt text.
π¨ 2. Poor Color Contrast
Low contrast between text and background colors makes content unreadable for users with visual impairments or color blindness.
β Common Issue
Text blends into the background due to insufficient contrast.
β Fix It
Ensure a contrast ratio of at least 4.5:1 for normal text, and 3:1 for large text.
π§ Example
/* Too light */
color: #cccccc;
background: #ffffff;
/* Better */
color: #333333;
background: #ffffff;
Use the WAVE contrast checker or WebAIM contrast tool to validate.
π§© 3. Improper Heading Structure
Headings help screen reader users understand the page structure and quickly navigate between sections.
β Common Mistakes
- Skipping heading levels (e.g.,
<h1>β<h3>) - Using headings for styling only
- Missing
<h1>altogether
β Best Practices
- Use only one
<h1>per page, usually as the page title. - Maintain a logical hierarchy:
<h1>β<h2>β<h3>, and so on. - Donβt skip levels.
π§ͺ Example
<!-- Correct order -->
<h1>Page Title</h1>
<h2>Section 1</h2>
<h3>Sub-section</h3>
<!-- Skipped order (bad) -->
<h1>Page Title</h1>
<h3>Sub-section</h3> <!-- Skipped h2 -->
π§ Use the WAVE tool to view the heading outline visually and fix skipped levels.
π 4. Form Inputs Without Labels
Unlabeled form controls are unusable with screen readers and keyboard navigation. Screen readers rely on label associations to describe the purpose of each input field.
β Issues
- No
<label>element - Only placeholder used (not accessible)
- Labels are not correctly associated
β Fix It
There are two valid ways to associate labels:
- Using
forandid - Wrapping input inside the
<label>
π§ͺ Examples
<!-- Good with for/id -->
<label for="email">Email:</label>
<input id="email" type="email" name="email">
<!-- Good with wrapping -->
<label>
Email:
<input type="email" name="email">
</label>
<!-- Using ARIA -->
<input type="email" aria-label="Enter your email">
β Donβt rely only on placeholder β it disappears after input and is not read consistently by assistive tools.
π 5. Keyboard Navigation Failures
Many users rely on keyboards (not mice) to interact with websites. All interactive elements must be reachable via the Tab key and should show a visible focus state.
β Keyboard Navigation Checklist:
- Can you tab to links, buttons, form fields, and controls?
- Does each element show a visual outline when focused?
- Can you tab out of all interactive elements? (No βkeyboard trapsβ)
π§ͺ Test it:
- Open your site
- Hit
Tabrepeatedly - Observe what gets focus and in what order
π οΈ Use tabindex="0" on custom elements to include them in the natural tab flow.
π§Ύ Summary Checklist
| β Fix | Description |
|---|---|
| Alt Text | Add meaningful alt for functional images, alt="" for decorative |
| Contrast | Maintain minimum contrast ratio (4.5:1 for normal text) |
| Headings | Use semantic headings in correct order; donβt skip levels |
| Labels | Associate each input with a visible or accessible label |
| Keyboard | Make sure all functionality works via keyboard only |
π Coming Up: Building Accessible Widgets with ARIA in React (Blog 3)
Next, weβll explore ARIA roles, states, and properties to build accessible custom components like dropdowns, modals, and toggle buttons β especially in React apps.
Top comments (0)