1Lawsuits
In many countries, web accessibility is a legal requirement under laws like the ADA (Americans with Disabilities Act). Companies are regularly sued for millions of dollars because their e-commerce sites cannot be used by screen readers. As a mid-level dev, protecting the company from this liability is part of your job.
2Step-by-Step Breakdown
Beyond Visuals. Juniors build for people with 20/20 vision and a mouse. Mid-level developers build for screen readers, keyboard navigation, and cognitive disabilities.
Semantic HTML. The foundation of a11y is Semantic HTML. Stop using <div onClick={...}>. Use <button>. The browser automatically gives buttons keyboard focus and screen reader context.
ARIA Attributes. When HTML isn't enough (like a custom dropdown), you use ARIA (Accessible Rich Internet Applications) attributes to tell the screen reader what the element is and its state.
Focus Management. Keyboard users rely on 'focus'. When a modal opens, you must trap the focus inside the modal. When it closes, return focus to the button that opened it.
Knowledge Check. Why is it an accessibility violation to attach an onClick event to a <div> element to make it act like a button, without adding any other attributes?
- →Divs cannot receive keyboard focus naturally and screen readers don't know they are clickable
- →React will throw a runtime error if you put onClick on a div
Color Contrast. WCAG guidelines require a contrast ratio of at least 4.5:1 for normal text. Light gray text on a white background is illegal in many jurisdictions.
Alt Text. Every <img> must have an 'alt' attribute. If it's decorative, use an empty string (alt=''). If it conveys meaning, describe it concisely for visually impaired users.
Forms and Labels. Every <input> MUST have an associated <label> using the 'for'/'htmlFor' attribute. Placeholders are NOT accessible labels.
Testing a11y. Use tools like Lighthouse, axe-core, and literally unplug your mouse and navigate your site using only the Tab and Enter keys.
Summary. Accessibility is not a feature. It is a fundamental requirement.
