The job: “Find out what makes my website hard to use, especially for people with disabilities, and get a fix list in order”
UX and accessibility audit with Claude and Playwright MCP: WCAG 2.2 checks and a fix list
Have Claude open your site in a real browser with Playwright MCP, check it against WCAG 2.2 level AA (contrast, keyboard, focus, alt text, labels, target size) and write a prioritized fix list. Then let it fix the worst issues and check its own work.
- Level Intermediate
- Time 45-60 minutes
- Works with
- Claude Code
- Claude Desktop
On this page12 sections
You can’t see your own site the way a keyboard user, a screen reader user or someone with low vision does. This guide has Claude do a first pass for you. With Playwright MCP, Claude opens your site in a real browser, measures color contrast, presses Tab through every link and field, and reads the page the way assistive technology does. You get back a table of issues, each tied to a WCAG 2.2 rule, sorted so the worst come first, with the exact fix.
We tested this on a made-up bakery page we broke on purpose: no page language, images without alt text, light grey text, a fake button made from a <div>, focus outlines turned off, form fields without labels, tiny share icons and a fixed promo bar at the bottom. Claude found all of the problems we planted, plus one we hadn’t planned (the hero image made the phone layout scroll sideways). It reported 19 issues, and its contrast numbers matched ours exactly (2.32:1, 2.17:1 and 4.00:1). A second prompt fixed the 11 worst issues. We re-checked them ourselves in a separate browser and they held.
What you’ll have at the end
- An
audit.mdreport: a summary, an issue table (what, where, which WCAG rule, who it affects, severity, fix), measured contrast ratios, a keyboard walk-through, and a list of what still needs a human. - Screenshots of your page at laptop and phone size.
- The worst issues fixed, with a “Re-check” section that says how each fix was confirmed.
What you need (and cost)
| Item | Details |
|---|---|
| Claude Code | In a terminal or the Code tab of Claude Desktop. Needs a Pro, Max, Ultra, Team, Enterprise or Console account. Claude Desktop’s chat can also use Playwright MCP; we tested Claude Code. |
| Node.js 18 or newer | Playwright MCP runs with npx, which comes with Node.js. |
| Playwright MCP | Free and open source (Apache 2.0), from Microsoft. Runs on your computer. No account. |
| Your site | Your site’s files on your computer (best), or the address of a site you own. |
Cost: your Claude plan’s normal usage. Nothing else is paid.
WCAG 2.2 AA in two minutes
WCAG (Web Content Accessibility Guidelines) is the W3C’s standard for accessible web pages. Version 2.2 became a W3C Recommendation in October 2023. Each rule is a numbered success criterion with a level: A (the minimum), AA (the usual target), AAA (the highest). This guide checks levels A and AA. These are the ones that come up most on small sites, quoted from w3.org:
| Check | Criterion | What it requires |
|---|---|---|
| Alt text | 1.1.1 Non-text Content (A) | Images and icons have a text alternative that serves the same purpose. |
| Contrast | 1.4.3 Contrast (Minimum) (AA) | Text has a contrast ratio of at least 4.5:1. Large text (about 24px, or about 18.7px bold) needs 3:1. |
| Buttons and icons | 1.4.11 Non-text Contrast (AA) | Parts you need to see to use a control have 3:1 against what’s next to them. |
| Keyboard | 2.1.1 Keyboard (A) | Everything works with a keyboard. |
| Focus | 2.4.7 Focus Visible (AA) | You can see which element has keyboard focus. |
| Hidden focus | 2.4.11 Focus Not Obscured (Minimum) (AA), new in 2.2 | A focused element isn’t completely hidden, for example by a sticky banner. |
| Tap targets | 2.5.8 Target Size (Minimum) (AA), new in 2.2 | Clickable things are at least 24 by 24 CSS pixels, or have enough space around them. |
| Labels | 3.3.2 Labels or Instructions (A) | Form fields have labels or instructions. |
| Basics | 2.4.2 Page Titled (A), 3.1.1 Language of Page (A) | The page has a descriptive title and a set language. |
What this audit is not. The W3C says tools “cannot check all accessibility aspects automatically” and that human judgement is required. Claude is a strong first pass, but it doesn’t replace testing with a screen reader or with disabled users, and this report is not a legal compliance statement.
Step 1: Add Playwright MCP to Claude Code
In a terminal, run:
claude mcp add playwright npx @playwright/mcp@latest
Start Claude Code and type /mcp. You should see playwright in the list. In Claude Desktop, follow the setup on the Playwright MCP page. If this is your first MCP server, Have Claude click through and test your web app walks through it with screenshots.
Step 2: Serve your site on your computer
Playwright MCP’s README says it blocks file:// addresses by default, so double-clicking index.html won’t work. Run a small local web server instead. Open a terminal in the folder that holds your index.html and run:
python3 -m http.server 8765
Leave that window open. Your site is now at http://localhost:8765. (On Windows, use python or py if python3 isn’t found.)
Auditing a live site instead? Use its address in the prompt, but only audit sites you own or have permission to test. See the safety note below.
Step 3: Run the audit
Open Claude Code in your site folder (not the server window) and paste this prompt. It’s exactly the one we ran:
Use the Playwright browser to audit http://localhost:8765 for UX and accessibility against WCAG 2.2 level AA. Only look, never submit real data anywhere except this local page.
Check, at a desktop size (1280x800) and a phone size (390x844):
1. Page basics: page title, page language, headings structure, landmarks.
2. Images: every image has a useful text alternative, or is marked decorative.
3. Contrast: measure the contrast ratio of text and buttons against their background with browser_evaluate (4.5:1 for normal text, 3:1 for large text and for button edges and icons).
4. Keyboard: press Tab through the whole page. Can you reach and use every link, button and form field? Is the focus always visible? Is anything focused hidden behind a sticky or fixed bar?
5. Forms: does every field have a visible label? Submit the form empty and judge the error message.
6. Links and targets: is the purpose of each link clear from its text? Are clickable things at least 24 by 24 CSS pixels?
Write audit.md with:
- A one-paragraph summary.
- A table of issues: #, what is wrong, where (the element), WCAG success criterion number and name, who it affects, severity (Blocker / Serious / Moderate / Minor), and the exact fix (code if short).
- The issues sorted so Blockers come first.
- A "What I could not check" section (things that need a human or a screen reader).
Take one screenshot at each size and save them as audit-desktop.png and audit-phone.png. Do not change the site files.
Claude Code asks for permission before it uses the browser tools; approve them. Our run took about a minute and a half.
Why the prompt is built this way:
- “Measure with browser_evaluate” makes Claude compute real ratios from the page’s colors in the browser, instead of judging them from a screenshot.
- “Press Tab through the whole page” is the keyboard test a person would do. In our run, Tab skipped the fake “Send order” button and the share icons, which is how Claude knew they couldn’t be used without a mouse.
- Severity levels turn a long list into an order of work. “Blocker” means someone can’t finish a task at all, like placing an order.
- “What I could not check” keeps the report honest about its limits.
Step 4: Read the report
Start with the Blockers. In our test, the top four were: the order button was a <div>, focus outlines were removed everywhere, form fields had placeholders but no labels, and the share icons were clickable <span>s with no name. Each row had a short code fix, such as:
<button type="submit" class="btn">Send order</button>
Three habits that make the report more useful:
- Check each cited rule on w3.org. Claude cited the right criteria for every issue we planted, but on borderline items it sometimes listed extra ones. The WCAG 2.2 page has the exact wording.
- Watch for guesses. Our report said the images “may not exist” and blamed a console error on them. They did exist; the error was something else. Treat words like “probably” as a cue to check yourself.
- Read the “could not check” list. Ours named screen reader behavior, what the images show (so what the alt text should say), 400% zoom and a real phone. Those are your manual tasks.
Step 5: Fix the worst issues and re-check
Paste this prompt. We ran it right after the audit:
Fix every Blocker and Serious issue in audit.md in site/index.html. Keep the text and the look the same except where a fix needs a change (for example a darker color). Then use the Playwright browser to re-check only those issues at http://localhost:8765, and add a "Re-check" section to audit.md that says for each one: fixed, partly fixed, or not fixed, and how you checked.
Change site/index.html to your file. In our test, Claude marked 10 issues fixed and 1 partly fixed: it gave the logo a name and marked the hero image decorative (alt=""), and said a real photo would need real alt text. We then checked in a separate browser: page language and title set, one h1 and three h2 headings, no image without alt, every field labeled, every Tab stop showing an outline, and the lowest text contrast at 6.6:1.
Then fix the Moderate and Minor issues the same way, or by hand.
Safety: what the browser can do
Playwright MCP controls a real browser. It can click buttons and submit forms. On a live site that could place an order, send a contact message or change settings.
- Audit a local copy whenever you can, as in this guide.
- On a live site, keep the “Only look, never submit real data” line, and don’t run it while logged in to an admin account or anywhere with saved payment details.
- Review each browser action before you approve it if you’re unsure.
What can go wrong
- “Browser is not installed.” Playwright MCP needs a browser it can start. Its README lists a
--browseroption (chrome, firefox, webkit, msedge) and an--executable-pathoption for a browser already on your computer. In our test machine, the default browser was missing and we pointed--executable-pathat an installed Chromium. - “Connection refused” at localhost. The server window from step 2 was closed. Start it again.
- Only one page checked. The prompt audits one address. List your important pages (home, contact, checkout) and run it once per page, or ask Claude to follow the main menu links.
- Contrast on images or gradients. Ratios over a photo or a gradient are hard to measure. Claude may skip them or measure one spot. Check those by eye.
Make it yours
- Turn it into a skill. Save the step 3 prompt as a skill so you can run “audit this page” anytime. Turn a repeated prompt into a skill shows how.
- Run it every week. Schedule the audit for your live site and get the report by email, with scheduled agent tasks.
- Scripted checks. The webapp testing skill helps Claude write Playwright scripts you can keep and rerun, for example a contrast check after every change.
Next steps
- New page built from a sketch? Run this audit on it: Screenshot to working UI with Claude.
- Just restyled your site? Audit it after Restyle your site with a modern design, since new colors and motion are where problems come in.
- Put the fixed version online with Build and deploy a website with Netlify.
Sources
- w3.org/TR/WCAG22/ (opens in a new tab)
- w3.org/WAI/standards-guidelines/wcag/new-in-22/ (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/contrast-minimum.html (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/non-text-content.html (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/keyboard.html (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/focus-visible.html (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html (opens in a new tab)
- w3.org/WAI/WCAG22/Understanding/target-size-minimum.html (opens in a new tab)
- w3.org/WAI/test-evaluate/tools/selecting/ (opens in a new tab)
- github.com/microsoft/playwright-mcp (opens in a new tab)
- raw.githubusercontent.com/microsoft/playwright-mcp/main/README.md (opens in a new tab)
- code.claude.com/docs/en/mcp (opens in a new tab)
- code.claude.com/docs/en/setup (opens in a new tab)
Related guides
Restyle your site with a modern design using Claude's frontend design skill
Give an old-looking web page a modern look with Claude Code and Anthropic's frontend-design skill: a bento grid, bold type, automatic dark mode and one calm entrance animation that switches off for people who ask for less motion. Your text stays exactly the same.
Beginner30-45 minutes
Screenshot to working UI with Claude: turn a sketch or whiteboard photo into a web page
Take a photo of a whiteboard, a paper sketch or a screenshot you like, give it to Claude, and get a working web page with real buttons and forms. Then compare a screenshot with your sketch and fix the differences.
Beginner30-45 minutes
Translate your website into 3 languages with Claude Code, without breaking it
Use Claude Code to add Spanish, Korean and Japanese versions of a small website, with a glossary, a language switcher and hreflang tags, then run a checker script that catches broken links, forms and missed text before you publish.
Intermediate45-90 minutes for a small site (2-10 pages)