# Auditing my own site for WCAG 2.2 AA — and what scanners miss

> On 25 November 2026 this site had ten HTML pages, including its 404 page, and three color themes. Two edits to muted text colors fixed five failing token pairs. The keyboard and theme controls needed separate checks.

By Andy Wang · 29 Nov 2026 · https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa

Written with AI from my WCAG 2.2 AA audit of wangyaodi.com in commit 4ada289. See "How this post was made" at the end.

This is the Markdown copy of the post, for AI tools and agents. The web page has the diagrams and charts; here each one is described in words.

---

I offer an [accessibility audit and remediation service](https://www.wangyaodi.com/accessibility) on this site. When I actually inspected `wangyaodi.com` itself against WCAG 2.2 AA—across all 10 HTML pages and all 3 color themes—I found real accessibility bugs on my own front door.

Five foreground-and-background color pairs failed the 4.5:1 contrast threshold. Six of ten pages had no `<main>` landmark. Two pages had no `<h1>` at all. None had a skip link. The change also introduced a shared `:focus-visible` style. Scroll-reveal sections stayed invisible without JavaScript and ignored `prefers-reduced-motion`. And the theme switcher cycled through three themes while showing only two icons and announcing a static label.

None of those bugs are unusual. They are the exact issues that sneak into clean, handcrafted developer sites and modern SaaS marketing pages alike. This post walks through what I found, the accessibility changes in [commit 4ada289](https://github.com/yorzi/wangyaodi.com/commit/4ada289a021349f79caecc00ad0029f2d7eba41d), what I could check from code, and what still needs manual assistive-tech testing before I would call the job complete.

**In short:** Auditing wangyaodi.com across 10 pages and 3 themes turned up 5 failing contrast pairs, 6 missing `<main>` landmarks, 2 pages without an `<h1>`, and keyboard, motion, and toggle-state gaps that single-page scans miss. The token edits address contrast. Six lines in `bin/check-site` check for three structural regressions, while manual VoiceOver/NVDA testing remains the next step.

- 10 pages + post template audited across 3 color themes
- 5 → 0 failing contrast pairs (all 36 pairs now ≥ 4.5:1)
- 6 pages given a missing <main> landmark
- 6 lines added to bin/check-site so structural fixes stay locked in

If you only have a minute, this image is the whole post:

![Summary of the post. Auditing my own site for WCAG 2.2 AA and what scanners miss. Stats: 36/36 theme contrast pairs at least 4.5 to 1 (was 31/36), 6 pages given a missing main landmark, 2 pages promoted from h2 to h1, 6 lines added to bin/check-site. Pass 1 caught 5 failing contrast pairs in Paper and Terminal, 6 missing main landmarks, and 2 missing h1 headings. Pass 2 caught missing skip link and reliance on default focus styling, scroll-reveal hidden without JS or reduced-motion support, and a 3-theme button with only 2 icons and a static aria-label. CI gate locks landmarks and skip links in place while noting manual keyboard, 200% zoom, and VoiceOver/NVDA checks still come next.](https://www.wangyaodi.com/assets/blog/auditing-my-own-site-for-wcag-2-2-aa/summary.jpg)

*The post in one image. [Open it full size](https://www.wangyaodi.com/assets/blog/auditing-my-own-site-for-wcag-2-2-aa/summary.jpg) to save or share it.*

## Why an automated scan is only half the audit

I started with two things I could count from the source: contrast between solid color tokens and the pages with a main landmark and top-level heading. Then I read the keyboard, theme, and motion code. A scan of one rendered page in one theme samples only one of those states.

**In short:** Automated math and DOM checks caught failing contrast tokens, missing `<main>` landmarks, and missing `<h1>` headings; source inspection identified skip-link, focus-style, reduced-motion, no-JS, and control-announcement gaps.

> **Figure 1. Both passes were necessary: contrast math and DOM checks found broken tokens and landmarks, while inspecting keyboard, motion, and control state found the usability gaps.**
>
> What automated checks caught vs. what code and keyboard review caught.
>
> Two columns showing the two audit passes on wangyaodi.com. Pass 1 (Automated math and DOM checks) caught 5 failing contrast pairs across Paper and Terminal themes, 6 pages missing a main landmark, and 2 pages with zero h1 headings. Pass 2 (Code, keyboard, and preference review) found missing skip links, reliance on default focus indicators, scroll-reveal content hidden without JS or reduced-motion support, a 3-theme toggle with 2 icons and a static label, and late theme selection.

The Terminal theme illustrates the sampling problem. Even within that theme, muted text passes on the page background and fails on the old card color. A passing measurement on the homepage tells you little about text inside that card.

## Pass 1: What contrast math and structural checks caught

### 1. Five failing contrast pairs hidden behind two muted tokens

This site ships three themes—`paper` (light), `ink` (dark warm), and `terminal` (dark green)—each defining four foreground tokens (`--ink`, `--ink-soft`, `--ink-mute`, `--accent`) rendered on three background surfaces (`--bg`, `--bg-soft`, `--card`). The matrix uses plain token values from that revision. That is 36 foreground-on-background combinations to verify against WCAG 2.2 SC 1.4.3 (`4.5:1` minimum for normal text).

Running the W3C relative luminance formula across all 36 pairs showed that primary body copy, secondary copy, and accent links passed on all three tested surfaces in each theme. Every single failure came from `--ink-mute`—the token used for timestamps, metadata labels, eyebrows, and table hints:

- In **Paper**, `--ink-mute` was `#84848d`. Against `--bg` (`#f4f1ea`) it scored **3.29:1**; against `--bg-soft` (`#ebe7dd`), **3.00:1**; against `--card` (`#faf8f2`), **3.49:1**. All three surfaces failed 4.5:1.
- In **Terminal**, `--ink-mute` was `#6a8a78`. Against `--bg` (`#0c1a14`) it barely scraped by at **4.70:1**, but on `--bg-soft` (`#102219`, **4.36:1**) and `--card` (`#0f2118`, **4.41:1**) it dropped below 4.5:1.
- In **Ink**, `--ink-mute` (`#8a857a`) already passed all three surfaces: `5.13:1` on `--bg`, `4.72:1` on `--bg-soft`, and `4.86:1` on `--card`.

Fixing all five failures took changing exactly two hex values across the stylesheets: `#84848d` → `#5f5f68` in Paper, and `#6a8a78` → `#7ea18d` in Terminal. Both stayed visually muted relative to body text while clearing 4.5:1 on every surface.

**In short:** Darkening Paper's `--ink-mute` from `#84848d` to `#5f5f68` and brightening Terminal's from `#6a8a78` to `#7ea18d` took the site from 31/36 passing contrast pairs to 36/36 (lowest changed pair rounds to 5.12:1).

> **Figure 2. Two token edits eliminated all five contrast failures across the site's light and dark palettes in the tested solid-color palette.**
>
> WCAG 2.2 AA contrast ratios for muted text tokens before and after commit 4ada289.
>
> Horizontal grouped bar chart comparing contrast ratios before and after commit 4ada289 against the 4.5 to 1 WCAG 2.2 AA threshold. Paper on --bg moved from 3.29 to 5.60; Paper on --bg-soft from 3.00 to 5.12; Paper on --card from 3.49 to 5.95; Terminal on --bg-soft from 4.36 to 5.83; Terminal on --card from 4.41 to 5.89; Terminal on --bg from 4.70 to 6.28. All six pairs now exceed 4.5 to 1.

| Theme | Surface | Background | Before | After | Status |
|---|---|---|---|---|---|
| Paper | `--bg` | `#f4f1ea` | 3.29:1 (`#84848d`) | 5.60:1 (`#5f5f68`) | Pass (≥ 4.5:1) |
| Paper | `--bg-soft` | `#ebe7dd` | 3.00:1 (`#84848d`) | 5.12:1 (`#5f5f68`) | Pass (≥ 4.5:1) |
| Paper | `--card` | `#faf8f2` | 3.49:1 (`#84848d`) | 5.95:1 (`#5f5f68`) | Pass (≥ 4.5:1) |
| Terminal | `--bg-soft` | `#102219` | 4.36:1 (`#6a8a78`) | 5.83:1 (`#7ea18d`) | Pass (≥ 4.5:1) |
| Terminal | `--card` | `#0f2118` | 4.41:1 (`#6a8a78`) | 5.89:1 (`#7ea18d`) | Pass (≥ 4.5:1) |
| Terminal | `--bg` | `#0c1a14` | 4.70:1 (`#6a8a78`) | 6.28:1 (`#7ea18d`) | Pass (≥ 4.5:1) |

Notice one subtle lesson from the Terminal row: testing only against `--bg` would have marked `#6a8a78` as passing (4.70:1), completely missing that the exact same token failed inside cards (4.41:1) and tinted sections (4.36:1). Always check every text token against every surface token it can sit on.

### 2. Six pages missing `<main>`, and two pages missing `<h1>`

Checking document landmarks and heading outlines across all 10 pages surfaced two classic template-drift bugs:

- **Missing `<main>` landmark:** The blog pages had `<main>`, while six standalone pages (`index.html`, `oss.html`, `products.html`, `rails-maintenance.html`, `vibecare.html`, and `accessibility.html`) placed `<header>` and `<section>` elements directly inside `<body>`. Screen-reader users jumping by landmark had no main region to jump to.
- **Zero `<h1>` elements on two pages:** Both `oss.html` and `products.html` used `<h2 class="display">` for the page title. Visually, the font size looked identical to an `<h1>`; semantically, the page had no top-level heading.

After the commit, the ten pages and `templates/post.html` each contained one main landmark with `id="main"` and one `<h1>`.

## Pass 2: What automated scanners miss or under-explain

The next pass followed the markup and scripts from page entry to theme selection. These findings come from the source diff. A keyboard or screen-reader walkthrough would test how the changes feel in use.

**In short:** Pass 2 fixed four real usability bugs that automated scans rarely flag clearly: adding a skip link and visible `:focus-visible` ring, making `.reveal` safe for no-JS and `prefers-reduced-motion`, giving the 3-theme button 3 icons plus a dynamic `aria-label`, and choosing the initial theme before paint.

### 1. Keyboard bypass and visible focus (WCAG 2.4.1 & 2.4.7)

With no skip link, keyboard users following the tab order had to traverse repeated navigation. The old CSS relied on browser defaults for focus. The change made focus styling explicit across themes.

In commit `4ada289`, every page gained a visually hidden `<a class="skip-link" href="#main">Skip to main content</a>` that slides into view on focus, paired with a consistent 2px accent outline (CSS excerpt):

```css
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { border-radius: 4px; }
.theme-btn:focus-visible, .pill:focus-visible { border-radius: 999px; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  transform: translateY(-140%); transition: transform .15s ease;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; }
```

### 2. A three-state control with two icons and a mute label (WCAG 4.1.2)

The theme toggle cycles through three states: `paper` → `ink` → `terminal`. Before this audit, the button only contained two SVG icons (sun and moon—so both dark themes looked identical) and had a static accessible name (for example, `Toggle theme` on the homepage). The button’s name gave no indication of its current or next theme.

The fix added a third icon (`>_` for Terminal) and updated `apply(t)` in `blog.js` (and each standalone page's script) to keep `aria-label` and `title` synchronized with state:

```javascript
const order = ['paper', 'ink', 'terminal'];
const names = { paper: 'Paper', ink: 'Ink', terminal: 'Terminal' };

function apply(t) {
  document.documentElement.setAttribute('data-theme', t);
  if (btn) {
    const next = order[(order.indexOf(t) + 1) % order.length];
    const msg = `Theme: ${names[t]}. Switch to ${names[next]}`;
    btn.setAttribute('aria-label', msg);
    btn.setAttribute('title', msg);
  }
}
```

> **Figure 3. Activating the skip link jumps straight to `<main id="main">`, and every theme state pairs a distinct icon with an explicit accessible name.**
>
> Keyboard Tab path, focus ring, and 3-state theme toggle announcements.
>
> Top flow shows keyboard navigation: The first Tab focuses the skip link. Enter follows it to the main landmark, bypassing repeated navigation. Every focusable element uses a 2px accent focus-visible ring. Bottom strip shows the 3-state theme button cycle: Paper with sun icon announcing Theme: Paper. Switch to Ink; Ink with moon icon announcing Theme: Ink. Switch to Terminal; Terminal with prompt icon announcing Theme: Terminal. Switch to Paper.

### 3. Scroll-reveal opacity traps and motion preferences (SC 2.3.3, Level AAA)

The original stylesheet had a common progressive-enhancement bug:

```css
/* Before: if JS fails or is blocked, every .reveal section stays invisible */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
```

With JavaScript disabled, the old rule kept unenhanced content transparent. With JavaScript enabled, the scroll and reveal effects ignored the reader’s reduced-motion preference.

This covers JavaScript being disabled. A script error after the head adds `.js` can still leave content hidden. Scoping the hidden state behind `.js` (added synchronously in `<head>`) and short-circuiting both CSS and the `IntersectionObserver` when `prefers-reduced-motion: reduce` matches addressed the no-JavaScript and reduced-motion cases:

```css
/* After: visible by default without JS, and instant when reduced motion is set */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
```

### 4. Theme selection before paint and OS preference alignment

A visitor without a saved preference got a theme selected by UTC day. Applying it in a script near the end of the page could show the light theme briefly before the chosen colors appeared.

The new head script applies a saved choice first, otherwise choosing Ink or Paper from the OS preference. This lets the first paint use the intended colors.

> **Figure 4. Guarding reveal CSS behind `.js`, honoring `prefers-reduced-motion`, and resolving theme polarity in `<head>` keep content visible without JavaScript, suppress reveal motion on request, and apply the chosen theme before paint.**
>
> How progressive enhancement, reduced motion, and head theme initialization guard first paint.
>
> Three parallel paths from browser environment to safe rendering. Path 1: No JavaScript means html lacks the .js class, so .reveal stays visible at opacity 1. Path 2: prefers-reduced-motion set to reduce disables smooth scrolling and reveal translation in CSS and skips IntersectionObserver in JS. Path 3: Inline head script reads saved theme or prefers-color-scheme before first paint, so the chosen theme is available at first paint.

## Locking the baseline into CI so fixes do not regress

One-off accessibility cleanups decay the moment you copy a page or add a new blog post. Because this site already runs a dependency-free Python check script (`bin/check-site`) on pushes to main and on pull requests, locking in the structural baseline took six lines:

**In short:** Six lines in `bin/check-site` now fail the build if any page loses its single `<h1>`, its `<main>` landmark, or its `skip-link`.

```python
if len(re.findall(r"<h1\b", source)) != 1:
    err(where, "expected exactly one <h1>")
if "<main" not in source:
    err(where, "missing <main> landmark")
if 'class="skip-link"' not in source:
    err(where, "missing skip-to-content link")
```

These six lines inspect HTML source for the site’s conventions. The existing fragment checker separately verifies that a referenced local ID exists. A skip link could still point to the wrong existing ID, and text matching cannot establish that focus moves correctly. Activate it with the keyboard to check where the next Tab lands.

## Before and after, mapped to WCAG 2.2

**In short:** Only SC 1.4.3 was assessed numerically here. The other rows link implementation choices to relevant criteria. A single h1 and a main landmark are site conventions. The reduced-motion change goes beyond AA.

| WCAG 2.2 criterion | Observation before the change | What changed (`4ada289`) |
|---|---|---|
| **1.4.3 Contrast (Minimum)** | 5 of 36 theme token pairs scored `3.00:1`–`4.41:1` | Updated Paper `--ink-mute` to `#5f5f68` and Terminal `--ink-mute` to `#7ea18d`; all 36 pairs passed, with a minimum of 4.72:1 rounded |
| **1.3.1 Info and Relationships** | 6 pages lacked `<main>`; `oss.html` and `products.html` had zero `<h1>` | Added `<main id="main">` across all 10 pages + template; promoted page titles to `<h1>`; enforced in `bin/check-site` |
| **2.4.1 Bypass Blocks** | No skip link on any page | Added `Skip to main content` (`.skip-link`) targeting `#main` on every page; enforced in `bin/check-site` |
| **2.4.7 Focus Visible** | Focus styling relied on browser defaults | Added consistent `2px solid var(--accent)` `:focus-visible` outline with `3px` offset |
| **4.1.2 Name, Role, Value** | 3-theme button had 2 icons and static accessible name | Added Terminal `>_` icon and dynamic `aria-label` / `title` announcing current and next theme |
| **2.3.3 Animation from Interactions (AAA)** | `.reveal` animated regardless of OS motion setting and stayed hidden without JS | Scoped hidden state behind `.js` and disabled smooth scroll + reveal transitions under `prefers-reduced-motion: reduce` |

## Limits worth knowing — and what isn't done yet

The historical commit records source changes. The checks below still matter on the rendered site.

**In short:** This pass covered contrast math, DOM semantics, CSS/JS keyboard and motion guards, and CI checks. It is not a compliance certificate, legal sign-off, or a substitute for manual VoiceOver/NVDA screen-reader and 200% zoom testing.

- **Scope of the result:** The passing figures cover 36 solid token pairs at this commit. A WCAG 2.2 AA conformance claim would require evaluation of all applicable Level A and AA criteria on the pages in scope.
- **Manual assistive-tech pass is still required:** The contrast figures use solid CSS colors. Gradients, images, alpha blending, component states, and actual spoken output need rendered checks. Before claiming screen-reader verification on any site—including this one—I still want a live manual pass with keyboard-only Tab traversal, 200% browser zoom, and VoiceOver/NVDA on the rendered pages.
- **Static pages are the easy case:** A static portfolio has no multi-step checkout, comboboxes, live-region form errors, or modal focus traps. Real SaaS web apps need task-level walkthroughs on sign-up, billing, and core workflows—not just landing-page contrast fixes.

If you are running this same pass on your own site today, here is the 15-minute manual check to run right after fixing your code:

1. **Keyboard-only walkthrough:** Put the mouse aside. Press Tab from the address bar, activate the skip link, tab through every interactive control (links, toggles, disclosure summaries, copy buttons), and verify focus is always visible and never trapped.
2. **200% zoom and 320px reflow:** Zoom the browser to 200% and check narrow mobile width to make sure no navigation item, table, or SVG diagram forces awkward page clipping.
3. **Screen-reader spot check:** Turn on VoiceOver (macOS) or NVDA (Windows), jump by landmarks (`main`, `nav`), walk the heading outline (`h1` → `h2` → `h3`), and activate stateful buttons like the theme toggle or Full/Brief switch to confirm the spoken state matches what changed visually.

That exact split—practical code-level fixes, concrete WCAG 2.2 AA references, regression tests in your repo, and clear boundaries about what is and isn't tested—is how I run [web accessibility audits](https://www.wangyaodi.com/accessibility) for Rails and web teams.

## Read this with an AI

A plain Markdown copy of this post lives at [`/blog/auditing-my-own-site-for-wcag-2-2-aa.md`](https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa.md). Hand it to Claude, ChatGPT, or your coding agent to run the same two-pass audit on your own codebase.

**In short:** A Markdown copy lives at [`/blog/auditing-my-own-site-for-wcag-2-2-aa.md`](https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa.md). The full post includes copyable prompts for auditing contrast tokens, landmarks, focus, and motion in your repo.

Or paste one of these prompts into Cursor, Claude Code, or Codex:

**Audit all theme contrast pairs**

```text
Read https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa.md. Find every CSS custom property or color token across all light and dark themes in this repository, compute exact WCAG 2.2 AA contrast ratios for every foreground-on-background pair, list any pair below 4.5:1 (or 3:1 for large text, with essential UI graphics assessed separately under SC 1.4.11), and propose minimal hex adjustments that preserve the visual palette.
```

**Audit landmarks, focus, motion & toggle state**

```text
Read https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa.md. Check every page template and layout in this repo for: (1) exactly one <h1> and a <main> landmark, (2) a working skip-to-content link, (3) visible :focus-visible outlines across all themes, (4) scroll animations guarded against no-JS and prefers-reduced-motion, and (5) multi-state buttons whose accessible names reflect current state. Cite exact files and lines.
```

**Add a tiny CI regression gate**

```text
Read https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa.md. Propose the smallest CI test or script for this project's test runner that fails when any rendered page loses its single <h1>, <main> landmark, skip link, or image alt attributes.
```

## How this post was made

I wrote this post with AI, and every post here says how it was made:

- **Sources:** My own audit and diff of `wangyaodi.com` in commit [4ada289](https://github.com/yorzi/wangyaodi.com/commit/4ada289a021349f79caecc00ad0029f2d7eba41d) (25 November 2026), W3C WCAG 2.2 specifications, and the site's `bin/check-site` script.
- **Draft:** The article text, inline SVG figures, WCAG mapping table, and share cards, drafted with Antigravity from the exact diff and luminance calculations.
- **Checks:** On 27 November 2026 Codex compared both Git trees, recalculated 36 solid-token ratios per revision without rounding before comparison, and checked the criteria against WCAG 2.2.
- **Review:** Reviewed and approved for publication by Andy Wang.

If you spot an accessibility issue on this site—especially with a screen reader or keyboard setup I haven't tested yet—tell me on X and I will fix it.

## References

**In short:** W3C WCAG 2.2 criteria cited in this post and the site's [accessibility service page](https://www.wangyaodi.com/accessibility).

- [W3C Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/)
- [Understanding SC 1.4.3: Contrast (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
- [Understanding SC 2.4.1: Bypass Blocks (Level A)](https://www.w3.org/WAI/WCAG22/Understanding/bypass-blocks.html)
- [Understanding SC 2.4.7: Focus Visible (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html)
- [Understanding SC 4.1.2: Name, Role, Value (Level A)](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html)
- [Understanding SC 2.3.3: Animation from Interactions (Level AAA)](https://www.w3.org/WAI/WCAG22/Understanding/animation-from-interactions.html)
- [Web Accessibility Audits & Remediation](https://www.wangyaodi.com/accessibility) — how I run code-level audits for web and Rails teams

---

Discuss this post on X: reply to [@yorzi](https://x.com/yorzi) with a link to https://www.wangyaodi.com/blog/auditing-my-own-site-for-wcag-2-2-aa
