( Engineering Notes · 2026 · 4 min read )
Why Accessibility Audits Should Be Automated, and How to Build an AI Auditor You Can Trust
Layering deterministic WCAG checks, accessibility-tree rules and LLM vision into an auditor that is fast, cheap and precise.
About one in six people worldwide live with a significant disability, according to the WHO. For them, a missing button label or low-contrast text is not a cosmetic bug; it is a locked door. Accessibility is also increasingly a legal requirement: the European Accessibility Act has applied since June 2025, and many other countries have similar laws. Yet most teams still audit accessibility by hand, sampling a few screens a couple of times a year, while the app changes every sprint. This post is about building an automated AI auditor that developers can actually trust.
Why manual audits are not enough
Why this is hard to automate
WCAG success criteria come in three flavours, and each needs a different tool:
Using pure LLM vision for everything is slow, expensive and inconsistent. Using pure rules misses everything that needs judgement. The answer is to layer them.
How to build it
1. Capture the right evidence
For every screen, capture three things: a screenshot, the accessibility tree (the UI hierarchy with roles, labels and bounds), and an event log of focus and interaction. On Android, an AccessibilityService can read the active window's node tree and take screenshots. Upload each capture straight to object storage so the audit can run asynchronously.
2. Run deterministic checks first and the LLM last
Order the pipeline by cost. XPath queries over the tree catch clickable elements without labels, images without descriptions and inputs without hints. Pixel maths catches contrast and target-size failures. Only the criteria that need judgement go to the vision model.
def channel(c: int) -> float:
c = c / 255
return c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4
def luminance(rgb: tuple[int, int, int]) -> float:
r, g, b = (channel(c) for c in rgb)
return 0.2126 * r + 0.7152 * g + 0.0722 * b
def contrast_ratio(fg: tuple[int, int, int], bg: tuple[int, int, int]) -> float:
hi, lo = sorted((luminance(fg), luminance(bg)), reverse=True)
return (hi + 0.05) / (lo + 0.05) # WCAG AA: 4.5 for body text, 3.0 for large textFor target size, WCAG 2.2 (criterion 2.5.8, level AA) asks for at least 24 by 24 CSS pixels, and Android's own guidance recommends 48dp.
3. Fingerprint screens so you never pay twice
Hash the structure of the UI hierarchy, ignoring dynamic text, to recognise screens you have already audited. Skip vision calls for screens and criteria that are already decided, and pre-filter with XPath: a screen with no images never needs an image-alt-text check. These two ideas remove most of the wasted vision calls.
4. Model the audit as an explicit graph
Break the audit into nodes: ingest, triage, deterministic checks, vision checks, verification, deduplication and report. A graph framework such as LangGraph gives you per-node retries, checkpoints, and the ability to resume a half-finished audit instead of starting again.
5. Fight false positives on purpose
6. Write reports people can act on
Every finding needs the criterion, its severity, the screen, an annotated screenshot, the element's path in the tree and a suggested fix. A developer should be able to go from report to pull request without asking a single question.