keepcalculator

06 Numbers and Powers

Web Accessibility Guide for Front End Developers

Card No. 06·40636 · Updated · Standard formula, shown below

Web accessibility means building websites that everyone can use, including people with visual, motor, auditory, or cognitive disabilities. This guide explains the core standards, practical techniques, and common pitfalls you need to know as a front end developer, so you can create interfaces that work for all users.

Why Accessibility Matters

Around 15% of the world’s population lives with some form of disability, according to the World Health Organization. That’s over a billion people. Accessibility is not just a nice-to-have—it’s often a legal requirement. In the United States, the Americans with Disabilities Act (ADA) has been interpreted to apply to websites, and the Web Content Accessibility Guidelines (WCAG) are the international standard. Many countries have similar laws, so ignoring accessibility can expose your organization to lawsuits. But beyond compliance, accessible websites tend to have better SEO, lower bounce rates, and a wider audience. An accessible site is also easier to use on mobile devices and for older users.

The Core Standards: WCAG and WAI-ARIA

The Web Content Accessibility Guidelines (WCAG) are developed by the W3C. The current version is WCAG 2.2, which builds on 2.1 and 2.0. WCAG is organized around four principles: Perceivable, Operable, Understandable, and Robust (POUR). Each principle has specific success criteria, rated at three levels: A (minimum), AA (recommended), and AAA (highest). Most legal requirements target AA.

WAI-ARIA (Accessible Rich Internet Applications) is a separate W3C spec that provides HTML attributes to enhance accessibility for dynamic content and advanced UI components. Use ARIA only when native HTML doesn’t provide the needed semantics. For example, a custom dropdown menu might need role="listbox" and aria-expanded.

Semantic HTML: The Foundation

The most powerful accessibility tool is correct, semantic HTML. Use native elements whenever possible—they come with built-in keyboard support and screen reader announcements. For example:

  • Use <nav> for navigation, <main> for the primary content, and <footer> for the footer.
  • Use <button> for clickable actions, not <div> with a click handler.
  • Use <h1> through <h6> for headings, in a logical order without skipping levels.
  • Use <label> for every form input, either wrapping the input or using the for attribute.
  • Use <table> for tabular data with <th> for headers.

If you find yourself adding ARIA roles to a plain div, ask whether a native element would work better. Native HTML is more robust and requires less maintenance.

Keyboard Accessibility and Focus Management

Many users navigate without a mouse, using only the keyboard. All interactive elements must be reachable and operable via the Tab key. Ensure a visible focus indicator—don’t remove the default outline without providing a clear alternative. Manage focus for dynamic content: when a modal opens, move focus into it; when it closes, return focus to the triggering element. For single-page apps, update the document title and move focus to the new heading when the route changes. Use :focus-visible to show focus only for keyboard users, not mouse clicks.

Images, Color, and Contrast

Provide alternative text for images using the alt attribute. Decorative images can have empty alt text (alt="") so screen readers skip them. For complex images like charts, provide a text summary nearby. Contrast is critical: WCAG AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold). Use a contrast checker tool to verify. Never rely on color alone to convey information—add icons, patterns, or text labels. For example, a form error shouldn’t just turn the border red; it should include a message.

Forms and Error Handling

Forms are a common pain point. Each input needs a label, either visible or using aria-label. Group related fields with <fieldset> and <legend>. When a user submits a form with errors, list the errors at the top of the form and link to the specific field. Use aria-describedby to associate error messages with inputs. Ensure error messages are announced by screen readers, which often requires setting role="alert" or using aria-live. Finally, make sure the form can be completed with a keyboard alone, including dropdowns and date pickers.

Testing and Common Pitfalls

Automated tools like axe or Lighthouse can catch about 30% of issues. Manual testing is essential. Use a screen reader (like NVDA or VoiceOver) to navigate your site. Test with keyboard only. Try zooming to 200% and using browser text spacing extensions. Common pitfalls include:

  • Missing alt text on images
  • Low contrast text
  • Buttons without accessible names
  • Focus indicators that are invisible or removed
  • Clickable elements that aren’t keyboard accessible
  • Dynamic content that doesn’t announce changes
  • Forms without labels or with vague placeholder-only labels

Also, don’t forget to test with real users when possible—automated tools can’t catch everything.

Frequently Asked Questions

What is the difference between WCAG A, AA, and AAA?

WCAG has three conformance levels. Level A is the minimum—it addresses the most critical barriers. Level AA is the recommended target for most sites and covers the majority of common issues like contrast and keyboard navigation. Level AAA is the highest and is not required for all content because it can be overly restrictive (e.g., requiring very high contrast that may be difficult for some color schemes).

Do I need to use ARIA on every element?

No. ARIA should be used sparingly, only when native HTML can’t provide the semantics. Overusing ARIA can confuse screen readers. The first rule of ARIA is: don’t use it if a native element works. For example, use a <button> instead of <div role="button">.

How do I make a custom dropdown accessible?

Use a native <select> if possible—it’s accessible out of the box. If you build a custom dropdown, you need to implement ARIA patterns: role="listbox", role="option", aria-expanded, and keyboard support (arrow keys, Enter to select, Escape to close). Also manage focus and announce the selected value.

What is the best way to test for accessibility?

Combine automated tools (like axe, Lighthouse, or WAVE) with manual testing. Automated tools catch obvious issues, but you must manually test with a keyboard and a screen reader. Also test with real users who have disabilities—they’ll find issues that tools can’t.

Does accessibility affect SEO?

Yes, indirectly. Many accessibility practices—like semantic HTML, descriptive alt text, proper heading structure, and good contrast—also improve SEO. Search engines can better crawl and understand your content, and users are more likely to stay on a usable site, reducing bounce rates.

Is it okay to use placeholder text as a label?

No. Placeholder text disappears when the user types, making it hard to remember what to enter. It also has poor contrast and isn’t reliably announced by screen readers. Always use a visible <label> element linked to the input.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →