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.
I offer an accessibility audit and remediation service 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, what I could check from code, and what still needs manual assistive-tech testing before I would call the job complete.
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.
<main> landmarkbin/check-site so structural fixes stay locked inIf you only have a minute, this image is the whole post:
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.
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.
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-mutewas#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-mutewas#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:1on--bg,4.72:1on--bg-soft, and4.86:1on--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.
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).
Read exact contrast table
| 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, andaccessibility.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: Bothoss.htmlandproducts.htmlused<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.
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):
: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:
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);
}
}
<main id="main">, and every theme state pairs a distinct icon with an explicit accessible name.3. Scroll-reveal opacity traps and motion preferences (SC 2.3.3, Level AAA)
The original stylesheet had a common progressive-enhancement bug:
/* 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:
/* 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.
.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.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:
Six lines in bin/check-site now fail the build if any page loses its single <h1>, its <main> landmark, or its skip-link.
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
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.
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:
- 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.
- 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.
- 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 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. Hand it to Claude, ChatGPT, or your coding agent to run the same two-pass audit on your own codebase.
A Markdown copy lives at /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
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
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
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.comin commit 4ada289 (25 November 2026), W3C WCAG 2.2 specifications, and the site'sbin/check-sitescript. - 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
W3C WCAG 2.2 criteria cited in this post and the site's accessibility service page.
- W3C Web Content Accessibility Guidelines (WCAG) 2.2
- Understanding SC 1.4.3: Contrast (Minimum) (Level AA)
- Understanding SC 2.4.1: Bypass Blocks (Level A)
- Understanding SC 2.4.7: Focus Visible (Level AA)
- Understanding SC 4.1.2: Name, Role, Value (Level A)
- Understanding SC 2.3.3: Animation from Interactions (Level AAA)
- Web Accessibility Audits & Remediation — how I run code-level audits for web and Rails teams