Skip to main content

Web Accessibility Fundamentals: How the Web Actually Works

Published 16 min readMarkdown
Part of seriesAccesibility: A Comprehensive Guide
Web Accessibility Fundamentals: How the Web Actually Works

Hello there👋

This is an engineer’s guide to accessibility - a practical attempt to explain how it actually works, and how to think about it when building real interfaces.

Most engineers think accessibility is:

  • “support screen readers”

  • “add aria-labels”

  • “run Lighthouse

That framing is wrong and leads to fragile systems.

This guide is part of a larger accessibility series:

  • Part 1 (this article): How accessibility actually works - from the accessibility tree to semantic HTML and keyboard interaction

  • Part 2: ARIA & advanced semantics

  • Part 3: How to Test Accessibility & Some Common Interview Questions

You can read this start to finish, or jump to the sections most relevant to you.

Accessibility = removing mismatches between how software works and how humans interact with the world. It is about ensuring people with disabilities can perceive, understand, navigate, and interact with the web - without special accommodations.

Disabilities are interaction mismatches, not “defects”:

  • Blindness - visual mismatch

  • Tremors - precision mismatch

  • ADHD - attention mismatch

  • Dyslexia - language processing mismatch

Disabilities include:

  • Visual (blindness, low vision, color blindness)

  • Auditory (deafness, hard of hearing)

  • Motor (limited fine motor control, paralysis, tremors)

  • Cognitive (ADHD, dyslexia, memory, processing speed)

  • Temporary & situational (broken arm, bright sunlight, bad internet, noise, fatigue)

Accessibility is not optional:

  • It’s law in many countries (ADA, EN 301 549, WCAG referenced)

  • It improves UX for everyone

  • It makes your app more robust, testable, and maintainable

It is your job as an engineer to design interaction systems that do not assume a single input method, sense, or cognitive speed.

Here are some examples of assumptions your system might make and who it excludes:

Assumption your UI makesWho it excludes
“User can see color”Color-blind users
“User uses a mouse”Keyboard-only users
“User can read small text”Low-vision users
“User can process fast animations”Motion-sensitive users
“User can remember context”Cognitive disabilities

Accessibility work is finding and removing assumptions.

If you’ve ever benefited from dark mode, captions, keyboard shortcuts, large click targets, you’ve benefited from accessibility.

The Accessibility Tree

It is important to note that assistive technology (ATs) like screen readers, do not read the DOM directly. They, instead, read the accessibility tree derived from it.

Unlike the DOM which is created from nodes of HTML elements connected from root to child elements, this tree is derived from semantic HTML elements, ARIA roles, accessible names, and states & properties. Two DOMs that look identical visually can be completely different to assistive tech.

An example:

Snippet 1

<div onClick={submit}>Submit</div>

Snippet 2

<button onClick={submit}>Submit</button>

Snippet 1 is Visually identical to Snippet 2 but accessibility is broken

Same pixels. Different tree. Different user experience.

The Foundations (You must internalize these)

WCAG (Web Content Accessibility Guidelines)

WCAG is the global standard for accessibility, focusing on 4 core principles: perceivable, operable, understandable, and robust (POUR), through specific, testable success criteria across different conformance levels (A, AA, AAA).

WCAG doesn’t teach you how to code. Instead, it defines non-negotiable truths your system must satisfy.

The POUR principles (engineering interpretation)

PrincipleMeaning
PerceivableUsers can perceive content (not invisible to any sense)
OperableUsers can interact with it
UnderstandableUsers can understand it
RobustWorks across assistive technologies

Perceivable

No critical information is locked behind a single sense. Information must be presented in ways that people can recognize and use, no matter how they consume it.

This means:

  • Don’t rely on a single sense: If information is only conveyed visually or only through sound, some users will miss it. Some examples of this includes: color alone indicating error (“red text = error”), sound-only alerts, or icon-only buttons without labels. A better alternative is to implement:

    • Color + text or icons

    • Visual and programmatic status messages

    • Icons with accessible names

This aids blind or low vision users, color blind users, deaf or hard-of-hearing users or users in a noisy or low-contrast environments.

  • Text alternatives for non-text content: Anything that isn’t text must have a text equivalent. Examples are:

    • Images must have alternative text <img src=”cat.jpg” alt=”a cat sitting on a wall” /> or a caption, <figure> & <figcapton>

        <figure>
          <img src="img.jpg" alt="my img"/>
          <figcaption> Your text </figcaption>
        </figure>
      
    • Icons must have accessible names

    • Charts must have summaries or data tables e.g. A bar chart showing the increase of brainrot in Gen Z from 2015 - 2025

    • Videos should have captions or transcripts. An example of this is live captions on Youtube. This bridges the gap for auditory impaired users, and even non-native speakers.

  • Sufficient contrast: Text and interactive elements must stand out from their background. This isn’t only about WCAG ratios or passing audits. It’s about:

    • Reading in sunlight

    • Fatigue

    • Low-quality displays

    • Aging eyes

Operable

This means all functionality is available via multiple input methods. An example is the use of keys on the keyboard for navigation. This is especially important for people with motor impairments, who cannot use a mouse, so they are not excluded from accessing your content.

If you can click it, you must be able to tab to it.

Consider:

  • Keyboard support: Allow navigation using tab keys and also ensure to provide visible focus indicators, outlines, to show which element is currently selected and what the current position is e.g. bold outlines

  • No time-based traps: For people with cognitive impairment, who may need more time to read, understand, and complete tasks, as compared to their peers, it is important to avoid time based interactions (e.g. session timeouts, timed responses) and to use easy to comprehend language. If time limits exist, provide: warnings, extensions, and/or, ways to disable them.

  • No interaction requiring precision: Fine motor control cannot be assumed. Avoid designs that require fine motor control, such as:

    • clicking small icons or precise pointer movements,

    • drag-only interactions,

    • hover-only controls.

Instead, implement:

  • Large, forgiving hit areas: An example is making the entire button clickable instead of just an icon or small target area.

  • Click + keyboard alternatives

  • Clear spacing between controls

  • Avoid physical discomfort or harm: This includes flashing content, rapid animations, or unexpected motion. We love our animations but, to an extent, let’s ensure that they are subtle, respect reduced motion preferences, and are not likely to induce seizures or dizziness.

Understandable

The system must behave predictably and communicate clearly. This is not about intelligence or technical skill or even dumbing things down - it’s about predictability, consistency and removing ambiguity.

  • Readable and clear content: Use plain language, avoiding unnecessary jargon. Also write clear labels, headings, and instructions, and expand abbreviations on first use. This helps people with cognitive disabilities, neurodivergent users, non-native speakers and users under stress or fatigue (temporary disability)

  • Predictable behavior: Interfaces should never surprise users. Some examples include:

    • Navigation doesn’t move unexpectedly

    • A button doesn’t suddenly act like a link

    • Focus doesn’t jump without user intent

    • Context doesn’t change on focus alone

The WCAG idea is that there be “No unexpected changes in context.”

This is especially important for screen readers, keyboard-only users or users with attention or memory challenges.

  • Error messages that explain what to fix: Errors will happen - accessible systems plan for them. Good practice is to:

    • write clear, specific error messages

    • explain what went wrong and how to fix it

    • preserve user input when errors occur

    • validate inputs early and clearly’

A bad example is “Invalid input” or “An error occurred”. A good one, “Password must be at least 12 characters and include a number” or “ Invalid username/password”

  • Clear labels and instructions: Every input needs a clear label. Remember: placeholder text is not a label. Also, ensure that instructions should be visible before interaction, not after failure.

Robust

This is the most engineering-heavy part of POUR. The system must survive different technologies and updates i.e. content must be robust enough to be interpreted reliably by a wide variety of user agents, including assistive technologies.

Robust systems continue to work when browsers update, screen readers change, new assistive tech appears, and the UI is refactored.

This, of course, translates to:

  • Valid HTML: Use semantic HTML first. These are the backbone of robustness. So, use

    • <button> instead of clickable <div>

    • <nav>, <main>, <header>

    • Proper heading hierarchy

    • Proper nesting

    • Unique IDs

    • No duplicate labels

    • Correct use of aria-labelledby, aria-describedby

This matters because browsers already know how to expose these correctly to assistive technologies which already understand them, and if we can minimize our use of ARIA, there’ll be fewer bugs

  • Minimal ARIA misuse: Following the import of semantic HTML, it is also important to note that ARIA must be correct or not used at all. ARIA (Accessible Rich Internet Applications) is an acronym that is closely known with Web Accessibility. It is a set of attributes for HTML that defines roles and states for dynamic content, which would make it understandable for assistive technologies. While powerful, it is also dangerous. Some common pitfalls include incorrect roles, missing or wrong ARIA states, and the override of native behavior. An instance, is , the use of a <div>, a non-semantic HTML element, in place of a button.

    Non-semantic just means it doesn’t describe its content or convey any special meaning.

    Div example:

      <div role="button" tabindex="0">
    

    Button example:

      <button>
    

    The former is less robust that the latter, because now you are responsible for: keyboard behavior, focus handling and states (pressed, disabled, etc.)

PrincipleMeaning
PerceivableUsers can perceive content (not invisible to any sense)
OperableUsers can interact with it
UnderstandableUsers can understand it
RobustWorks across assistive technologies

WCAG Levels

Each guideline has levels:

  • A – bare minimum

  • AA – industry standard (this is what we aim for)

  • AAA – ideal, rarely required

Most companies fail even A. If you only ever meet WCAG 2.1 AA, you are doing excellent work.

AAA is aspirational, not expected for most products. Even WCAG explicitly says:

It is not recommended that Level AAA conformance be required for entire sites.

WCAG Conformance

WCAG conformance is binary per criterion. You either meet it or you don’t.

There is no percentage, average, weighted score

So, if you fail one Level A criterion, you are not Level A and if you meet all Level A, but fail one Level AA, you are Level A, not AA

This is one thing that people can misunderstand. Each level is atomic, indivisible - it cannot be partial.

For instance, to claim WCAG 2.x AA conformance, a product must:

  1. Meet all Level A success criteria

  2. Meet all Level AA success criteria

  3. Across all relevant content and functionality

Failing any required criterion drops you down a level.

Each WCAG success criterion lives under one POUR principle, and has one conformance level

Example:

  • Perceivable - Color Contrast - Level AA

  • Operable - Keyboard Access - Level A

  • Understandable - Error Identification - Level A

  • Robust - Name, Role, Value - Level A

You meet a criteria across P, O, U, and R. Here’s a reference list of WCAG success criterion.

It’s important to note that not every WCAG criterion applies to every product. For instance, when there is no video, caption criteria don’t apply. You only evaluate applicable criteria.

This is why audits involve interpretation, not just tooling.

The Curb-curt effect

It is a common misconception that accessibility is only for a small percentage of the population. In reality, we all cycle in and out of 'disability' depending on our circumstances. A user might have a permanent visual impairment, but another might have a temporary one - like someone with dilated pupils after an eye exam - while a third faces a situational challenge, such as trying to read a smartphone screen in harsh, direct sunlight. This overlap leads to what is called the 'Curb-Cut Effect'. A phenomenon that describes how features designed for a marginalized group, like physical curb curs for wheelchairs, end up benefiting a much broader group, like parents with strollers.

It is the same reason why while closed captions are an aid for the auditory access, it also helps people that are in a noisy or quiet environment.

The Fundamentals

Semantic HTML as an API contract (90% of accessibility)

Have you ever seen this meme:

or this:

Ever heard of "Div Soup"? Where Semantic HTML is treated like a suggestion - an environment where buttons aren't buttons and lists aren't lists. Everything is just a generic <div> container with a cursor: pointer , and an onClick function.

I’ve done it, you’ve done it, and we both know it’s lazy coding.

The cold, hard reality is, of course, that semantic HTML isn't just about "clean code." It gives you four critical features for free:

  • Keyboard behavior e.g., Space/Enter to click

  • Screen reader meaning, giving context to users who can't see the screen

  • Focus management like the logical "tab" order

  • Accessibility API compatibility - how the OS communicates with the browser

React developers often destroy all four of these with a single, mindless?? <div>. When you replace a <button> with a div, you aren't just saving a few keystrokes; you're manually un-building the web.

90% of accessibility comes from using the right HTML element for the job. HTML elements, inherently, communicate meaning, role, and behavior - not appearance. That’s CSS.

When you’re choosing an element, you are immediately communicating what it is supposed to represent, it’s behavior e.g. a button is supposed to be pressable (onClick), keyboard interactions, and screen reader announcements.

Divs are especially dangerous in React cause it lets you do this:

<div onClick={submit} className="button">
  Submit
</div>

It looks like a button, but accessibility-wise, it:

  • is not focusable

  • has no keyboard support

  • has no role

  • has no accessible name

  • has no state

  • is invisible to assistive tech

That’s a fake button. In comparison, <button> is:

  • Focusable via keyboard

  • Activated with Enter and Space

  • Announces as “button”

  • Has disabled state

  • Works in forms

  • Handles ARIA states correctly

<button onClick={submit}>Submit</button>

<div> does nothing, means nothing, and announces nothing.

If you don’t use native elements, you take full responsibility for keyboard handling, focus management, and other native behavior.

Things to look out for

Utilize landmark Elements (Page-Level Semantics)

Landmarks allow users to jump around the page instantly. Some essential landmarks:

<header>
<nav>
<main>
<footer>
<aside>

Not having to depend on linear reading means screen reader users can press a single key to jump to main content, skip navigation, or navigate between regions. Without landmarks, they have to tab through everything.

<main> is non-optional. It represents the unique content**.** Every page must have one <main>. It should not be inside header, nav, or footer.

A layout example:

function Layout({ children }) {
  return (
    <>
      <Header />
      <Nav />
      <main id="main">
        {children}
      </main>
      <Footer />
    </>
  );
}

Let headings define the document outline

Ensure headings are hierarchical and act as navigation anchors as screen readers users navigate by headings.

<div className="text-xl font-bold">Settings</div> // bad❌
<h2>Settings</h2> // great stuff ✅

Try to have one <h1> per page (generally), never skip levels (h1 → h3 ) and try not to style headings just for size.

A button, <button>, performs an action, a link, <a>, navigates somewhere.

<a onClick={save}>Save</a> // bad❌
<button onClick={save}>Save</button> // great stuff ✅

The former is the wrong role and screen readers announces: “Open, link”, but it doesn’t go anywhere.

Use <nav> only for major navigation blocks

<!-- Great✅ -->
<nav>
<ul>
<li><ahref="/dashboard">Dashboard</a></li>
<li><ahref="/settings">Settings</a></li>
</ul>
</nav>

<!-- Bad -->
<div class="nav">

Screen readers announce will announce something akin to: “Navigation region”. This gives users orientation.

Lists Are Semantic Structures

If it’s a list visually, it must be a list semantically. Screen readers announce list length, users know where they are, and they get faster navigation.

// bad ❌
<div>
<div>Item 1</div>
<div>Item 2</div>
</div>

// good ✅
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>

Fieldsets & Legends

We tend to ignore or forget these elements. Try to group related controls:

<fieldset>
<legend>Notification preferences</legend>
<label>
<input type="checkbox" />
    Email
</label>
<label>
<input type="checkbox" />
    SMS
</label>
</fieldset>

Screen reader reads: “Notification preferences group”, giving instant context.

Tables: Use Only for Data

Tables are for tabular data, not layout. This allows screen readers announce row/column relationships. Also, users can navigate cell-by-cell

<table>
    <caption>User statistics</caption>

    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Logins</th>
        </tr>
    </thead>

    <tbody>
        <tr>
            <td>Tito</td>
            <td>42</td>
        </tr>
    </tbody>
</table>

Fragment overload

Fragments remove wrapper semantics. Try not to do this:

/* This could easily be a section element */
<> 
    <div>Title</div>
    <div>Content</div>
</>

Forms

First, labels,<label> , are not optional

<!-- bad -->
<input placeholder="Email" />

<!-- good -->
<label htmlFor="email">Email</label>
<inputid="email"type="email" />

A common mistake is replacing labels with placeholders. However, it is important to note that placeholders disappear on input, aren’t read reliably, and fail contrast requirements, so they cannot be announced.

Also, ensure errors are announced and are programmatically linked

<input aria-invalid="true" aria-describedby="email-error" />
<p id="email-error">Invalid email</p>

Do not rely on * for required fields

<label htmlFor="name">
Name <span aria-hidden="true">*</span>
</label>
<input id="name" aria-required="true" required />

Keyboard Accessibility & Focus

Remember, the O (Operable) rule. Keyboard-only users are not edge cases. There are blind, motor-impaired, and power users. If it can’t be used with a keyboard only with commands like Tab / Shift+Tab / Enter / Space / Escape, it’s broken.

You must also ensure that everything interactive must be focusable, and the focus order must be visible and logical.

Some default focusable elements include:

  • button

  • a[href]

  • input, select, textarea

  • [tabindex="0"]: this makes HTML elements focusable. Examples of tabindex values include:

tabindex="-1"   // removes from the tab index. Focusable via JS only (modals, skip links)
tabindex="0"    // include in tab order
tabindex="1+"   // ❌ Dont do this. (breaks natural order)

tabindex="-1": removes the element from the tab index. Focusable via JS only (modals, skip links)

tabindex="0": this inserts an element into the natural tab order, by its position in the HTML source code. It is particularly useful for making non-interactive elements e.g.<div> focusable and accessible via the Tab key, often when creating custom interactive components.

tabindex=”1” or tabindex=”2” forces an explicit order to the focusable elements

tabindex="1" -> tabindex="2" -> tabindex="3" -> tabindex="0" -> no tab index

DOM order must also always reflect visual order. Focus, like screen readers, follows DOM order unless you interfere. Therefore, changes like the example beneath where visual reordering happens without DOM order change, can cause confusion

flex-direction: row-reverse;

Focus

Never remove focus outlines globally:

</* bad */>
*:focus {
outline: none;
}

</* good*/>
:focus-visible {
    outline:2px solid#4f46e5;
}

Focus must also be visible, high contrast, and persistent. Don’t globally disable outlines.

</* good🟢 */>
:focus-visible {
    outline:2px solidvar(--focus-color); </* high contrast focus color */>
    outline-offset:2px;
}

ARIA

This was placed last for a reason. ARIA (Accessible Rich Internet Applications) should be used only when semantic HTML cannot express the interaction.

Conclusion

Understanding accessibility starts with how the browser and assistive technologies interpret your code. Understanding that foundation makes the rest easier, and maybe a bit harder, in the right ways.

In the next part, we’ll look at ARIA and advanced semantics.

Toodles💚

About the author

  • Hello World! I'm Tito. I write about designing and building real-world software — frontend, backend, infrastructure, system design, and data.

No comments yet. Be the first to comment.

Accesibility: A Comprehensive Guide

Part 1 of 3

A practical, end-to-end guide to web accessibility — from how browsers and assistive technologies interpret your code, to writing accessible interfaces, using ARIA responsibly, and testing your work in the real world.

Up nextARIA & Advanced SemanticsARIA = Accessible Rich Internet Applications ARIA exists because HTML wasn’t designed for modern UIs. We had to build custom widgets (modals, tabs, comboboxes, etc.) and screen readers need to understand those widgets. You do not need ARIA for button...

More from this blog