LEARNING OBJECTIVES ⌵
- Understand WCAG 2.2 Success Criterion 1.1.1 (Non-text Content, Level A) and its legal and ethical necessity.
- Master how assistive technologies (Screen Readers: NVDA, JAWS, VoiceOver) parse the HTML Accessibility Tree (a11y tree) for image elements.
- Apply the W3C Alt-Text Decision Tree to accurately classify images as informative, functional, decorative, or complex.
- Differentiate between
alt=""(empty/null alt for decorative images) and omitting thealtattribute entirely. - Craft contextual, concise, high-value alternative text that communicates intent and function rather than superficial visual minutiae.
📖 The Mental Model & Story (Intuitive Foundation)
Imagine walking into a high-end French restaurant where the waiter hands you a printed menu. If you can read the printed text, you immediately see the dish descriptions, wine pairings, and prices. But imagine you are sitting with a companion who has visual impairments. You wouldn't say: "Here is a color image of a ceramic white plate with dimensions 800 by 600 pixels containing brown circular organic material and green leaf garnishes."
Instead, you say: "Pan-seared Atlantic scallops served over truffle pea purée."
You conveyed the essence and meaning of the visual asset, not a raw pixel-by-pixel rendering.
Now, imagine the menu has an ornate gold filigree border printed around every page corner for decorative flair. You wouldn't interrupt your dinner conversation to announce: "Gold floral ornament top-left corner... Gold floral ornament top-right corner..." You completely ignore the decorative border because it conveys zero informational value.
+-------------------------------------------------------------------------------+
| IMAGE PURPOSE SPECTRUM |
| |
| [DECORATIVE] <---------> [FUNCTIONAL] <---------> [INFORMATIVE] <---------> |
| Background swirl, Search magnifying Chart showing Q3 |
| abstract divider. glass icon button. revenue growth (+18%). |
| |
| alt="" (Null alt) alt="Search site" alt="Bar chart: Q3..." |
| (Silenced for a11y) (Describes action) (Conveys exact data) |
+-------------------------------------------------------------------------------+
The alt attribute is not a caption, and it is not a tooltip. It is the programmatic textual substitute for people who cannot see the image, whether due to blindness, low vision, temporary eye injuries, screen reader use, or slow 2G mobile connections where image loading has failed or been disabled.
Technical Deep Dive & Specifications
The Accessibility Tree & Screen Reader Pipeline
Browsers maintain two primary internal tree structures:
- The DOM Tree (Document Object Model): Represents all HTML tags and attributes for rendering and scripting.
- The Accessibility Tree (a11y Tree): A filtered, semantic representation of the DOM passed directly to OS-level assistive APIs (UI Automation on Windows, NSAccessibility on macOS/iOS, AT-SPI on Linux).
HTML Markup: <img src="cart.svg" alt="View shopping cart (3 items)">
|
v
+-----------------------------------------------------------------+
| DOM Element: HTMLImageElement |
+-----------------------------------------------------------------+
|
v (Computed by Browser Engine)
+-----------------------------------------------------------------+
| Accessibility Node |
| - Role: "image" (or "graphic") |
| - Accessible Name: "View shopping cart (3 items)" |
+-----------------------------------------------------------------+
|
v
+-----------------------------------------------------------------+
| Screen Reader (NVDA / VoiceOver / JAWS) Output: |
| "Graphic, View shopping cart (3 items)" |
+-----------------------------------------------------------------+
The Crucial Difference: alt="" vs. Omitted alt
This is one of the most critical rules in web development:
| HTML Syntax | Accessibility Tree Role | Screen Reader Behavior | Use Case |
|---|---|---|---|
<img src="icon.svg" alt="Search"> |
Role: image, Name: "Search" |
Reads: "Graphic, Search" | Informative or Functional Image |
<img src="bg.svg" alt=""> |
Role: none / presentation |
Completely ignored (silent) | Purely Decorative Image |
<img src="photo.jpg"> (Missing alt) |
Role: image, Name: photo.jpg |
Reads raw filename or URL! | 🚨 Severe Accessibility Violation |
[!CAUTION] When the
altattribute is omitted entirely, the browser is forced to guess. Screen readers will often announce: "Graphic, https slash slash cdn dot company dot com slash assets slash upload underscore 77291a dot jpeg". This creates a frustrating, hostile user experience for blind users.
The W3C Alt-Text Decision Tree
[ Does the image exist? ]
|
v
[ Does the image convey critical information? ]
/ \
YES NO
/ \
[ Is the image inside an <a> or <button>? ] [ Is it purely decorative? ]
/ \ / \
YES NO YES NO
/ \ / \
[ FUNCTIONAL ] [ INFORMATIVE ] [ DECORATIVE ] [ COMPLEX CHART ]
Describe action: Describe meaning: Use null alt: Use short alt +
alt="Print invoice" alt="Smiling team" alt="" detailed text fallback
The 5 Functional Categories of Alt-Text
- Informative Images: Images that visually add new concepts, instructions, or context to the page.
- Example: An infographic illustrating photosynthesis.
- Alt rule: Summarize the visual finding concisely.
- Decorative Images: Stylistic flourishes, borders, background gradients, or images already described verbatim in adjacent text.
- Example: A decorative swoosh line under a heading.
- Alt rule: Use
alt=""(empty string) to remove it from the Accessibility Tree.
- Functional Images: Images that act as interactive triggers (inside
<a>or<button>).- Example: A printer icon that prints the document.
- Alt rule: Describe the action (
alt="Print document"), NOT the appearance (alt="Black printer icon").
- Images of Text: Visual graphics containing rendered typographic text (logos, promotional banners).
- Example: A company logo banner reading "Cyber Monday 50% Off".
- Alt rule: Transcribe the exact words contained within the image (
alt="Cyber Monday 50% Off").
- Complex Images: Data charts, architectural diagrams, schematics, and maps.
- Example: A multi-line quarterly sales chart.
- Alt rule: Provide a high-level summary in
alt, and provide full data in an adjacent HTML<table>or<figcaption>.
💻 Interactive Code Playground
Starter Code
Line-by-Line Code Breakdown
- Line 46 (
alt="A scientist in a cleanroom..."): Provides a vivid, contextual description of the visual scene. - Line 58 (
<img src="..." alt="" width="20" height="20">): Inside the<button>, the text label"Print Invoice"is already present in the DOM (<span>Print Invoice</span>). Giving the printer icon analt="Print"would cause a screen reader to announce: "Graphic Print, Print Invoice button". Usingalt=""silences the decorative icon, ensuring the screen reader announces only "Print Invoice, button". - Line 72 (
alt="" role="presentation"): Explicitly removes the horizontal divider graphic from the Accessibility Tree.
Expected Browser Render Output
+-------------------------------------------------------------+
| WCAG 2.2 Alt-Text Implementation Showcase |
| |
| [1. Informative Image] |
| +---------------------------------------------------------+ |
| | [SCIENTIST IN CLEANROOM EXAMINING SILICON WAFER] | |
| +---------------------------------------------------------+ |
| Semiconductor manufacturing cleanroom operations. |
| |
| [2. Functional Image (Button)] |
| [ 🖨️ Print Invoice ] |
| |
| [3. Decorative Flourish] |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| Section separator ignored by screen readers. |
+-------------------------------------------------------------+🏋️ Hands-On Exercise
🎯 The Challenge: Fix the Inaccessible Enterprise Dashboard
Instructions: Audit and fix the following broken corporate markup snippet:
- Item 1: An image showing the CEO portrait currently has no
altattribute. Add an informative description. - Item 2: A standalone navigation icon button linking to the user settings currently has
alt="blue cog icon picture". Refactor it to convey its true functional action. - Item 3: An ornamental abstract background wave image currently has
alt="abstract gradient vector". Fix it so screen readers ignore it completely. - Item 4: A bar chart image shows 2026 Q1 sales breakdown. Add a concise
altsummary and include a visually hidden or semantic fallback data table.
🏁 Starter Code Sandbox
⚠️ Common Pitfalls
- Redundant "Image of..." Prefixes: Never write
alt="Image of a red sports car". Screen readers already announce the element's role ("Graphic, red sports car"). Writing "image of" causes clumsy output: "Graphic, image of a red sports car". - Using Filenames as Alt Text: Writing
alt="IMG_59281.JPG"oralt="banner-v2-final.png"is useless and harms accessibility audits. - Copy-Pasting Captions into Alt: If an image is immediately followed by a visible caption
<p>The Golden Gate Bridge at dusk</p>, writingalt="The Golden Gate Bridge at dusk"forces screen reader users to hear the identical sentence twice in a row. Usealt=""or provide distinct, complementary detail. - Omitting
alton Interactive Links: Placing an<img src="logo.png">inside<a href="/">withoutaltcauses screen readers to read the link's URL path: "Link slash". Always usealt="Acme Corp Home".
💡 Pro Tips
- Context Determines Content: The exact same photograph of coffee beans requires different
alttext depending on context:- On a coffee shop homepage:
alt="Freshly roasted Ethiopian dark roast beans". - On an article about agricultural fungus:
alt="Coffee bean exhibiting severe rust discoloration along the center seam". - In a website footer background pattern:
alt="".
- On a coffee shop homepage:
- Automated CI/CD A11y Linting: Integrate tools like
@axe-core/clior ESLintjsx-a11y/alt-textinto your deployment pipeline to block builds where<img>tags lackaltattributes. - Search Engine Optimization (SEO): Google Image Search and Googlebot crawl
alttext to understand image context. Accurate, keyword-rich (but not keyword-stuffed)alttext directly improves Google Image search indexing.
📌 Key Takeaways
- WCAG 2.2 SC 1.1.1 mandates text alternatives for all non-text content.
alt=""(null alt) removes decorative images from the Accessibility Tree while keeping them visual for sighted users.- Omitting the
altattribute completely causes screen readers to read the raw image URL or filename. - For functional images inside links or buttons, the
alttext must describe the action or destination, not the physical visual icon. - Avoid phrases like "picture of" or "image of" in
alttext; the screen reader automatically announces the graphic role. - --