Disclosure: I am on the team behind VibUI, a paid prompt library for websites. You will see one mention of it in the last tool section. The accessibility rules here do not depend on it.
Short answer: if you want an AI-built page to pass a basic accessibility check, put the accessibility rules in the first prompt, not in a cleanup message after the layout is finished. Name the contrast target, heading order, form-label behaviour, keyboard focus, image alt rules, landmarks and a prefers-reduced-motion fallback up front. Then run a keyboard pass and an automated scan (Lighthouse or axe) before you call the page done. This applies the same way in v0, Lovable, Bolt, Cursor, Windsurf, Claude, ChatGPT, Gemini, Replit, GitHub Copilot, Framer AI, Google Stitch, Readdy, Aura.build and OpenAI Codex.
Why does a second "make it accessible" prompt usually fail?
Most models will happily add alt attributes and a focus ring if you ask later. They will also leave in place the decisions that caused the failures:
- Heading levels that skip from
h1toh4because the visual scale looked "right". - Buttons that are only
<div>s with a click handler. - Form fields with placeholder text and no
<label>. - Text on a coloured photograph that drops below a 4.5:1 contrast ratio.
- Carousels and background motion with no pause control and no reduced-motion path.
- Colour as the only way to show a required field or an error.
A cleanup prompt rarely rewrites the document structure. It patches symptoms. If the first prompt already forbids those patterns, the first draft is much closer to usable.
What accessibility rules should go in the first prompt?
Paste a block like this into every new-page request. Adjust the contrast figure if your legal or design team has a stricter target.
Accessibility constraints (do not skip): - One h1 on the page. Headings follow a logical order (h2 then h3). Do not skip levels for visual size. - Colour contrast: body text and buttons at least 4.5:1 against their background; large headings at least 3:1. Check both the default theme and any dark variant. - Every form control has a visible <label> bound with for/id. Do not use placeholder as the only label. Errors are text, not colour alone, and are linked to the field with aria-describedby. - All interactive elements are real buttons or links, reachable by keyboard, with a visible focus state that is not outline: none unless a clearer replacement is provided. - Images: informative images have specific alt text from [ALT] placeholders I provide. Decorative images use alt="". Do not invent descriptions of people or places. - Landmarks: a <header>, <main> and <footer>, plus a "Skip to main content" link as the first focusable element. - Target size: interactive elements at least 24px by 24px, with adequate spacing. - Motion: respect prefers-reduced-motion and provide a static fallback. No autoplaying video with sound. If a carousel exists, it does not auto-advance, and previous/next controls are keyboard accessible. - Language: set lang on the html element. Link text describes the destination; no "click here". The [ALT] placeholders matter. If you let the model write alt text, it will invent a scene that may not match the photo you later drop in.
What does a first prompt look like with those rules included?
Here is a compact example for a product marketing page. Swap the product details; keep the constraints.
Build a single landing page as semantic HTML and CSS (no framework unless I ask). Product: [NAME], a [ONE-LINE JOB] for [AUDIENCE]. Primary action: [BUTTON LABEL] linking to [URL]. Visual system: off-white background #F6F4EF, ink #1A1A1A, accent #1F4E8C, 16px body / 1.6 line-height, 8px radius, system sans-serif. No dark mode in this version. Sections in order: header with skip link and primary button; hero with [HEADLINE] and an image placeholder [ALT: ...]; three feature rows; a short pricing outline with [PLAN NAMES AND PRICES]; FAQ; footer with contact. Copy I have not supplied must appear as [PLACEHOLDER]. Never invent customers, logos, statistics or reviews. Include the accessibility constraints listed above. Do not use emoji, gradient text, icon-only navigation, or a cookie pop-up. If you are in Cursor, Windsurf, GitHub Copilot or OpenAI Codex, also name the file (app/pricing/page.tsx or pricing.html) and add "Do not edit other files." Narrow scope keeps the accessibility rules from being "forgotten" mid-edit.
Which failures should I check, and how do I prompt a fix?
Work through this table after the first draft. One failure per follow-up message.
| Failure | How you notice it | Follow-up prompt |
|---|---|---|
| Skipped heading levels | Outline in DevTools or an axe scan | "Fix heading levels only. Keep the visual size. Do not change copy." |
| Contrast too low | Lighthouse contrast items, or a contrast picker | "Raise contrast of [element] to at least 4.5:1 against [background]. Do not change layout." |
| Divs used as buttons | Keyboard tab skips them, or no Enter/Space handler | "Replace clickable divs with button or a elements. Keep the existing styles." |
| Missing labels | Screen reader says "edit text" with no name | "Add a visible label for each input, tied with for/id. Keep placeholders as examples only." |
| Focus outline removed | Tab through the page; you lose the caret | "Restore a 2px focus ring on all interactive elements, using the accent colour at 3:1 or better." |
| Motion with no off switch | Enable reduced motion in the OS and reload | "Wrap animation in a @media (prefers-reduced-motion: no-preference) block and show a static state otherwise." |
| Autoplaying video | The tab makes sound, or the CPU spins | "Do not autoplay with sound. Poster frame first; playback is user-started and has a visible pause control." |
Automated tools catch a lot. They will not catch a misleading heading, a vague link ("learn more" repeated six times), or alt text that does not match the image. Those need a human pass.
Does the same prompt work in hosted builders and in coding agents?
Yes, with a small difference in where the result lands.
- v0, Lovable, Bolt, Replit, Framer AI, Google Stitch, Readdy, Aura.build: paste the full prompt into the first generation. After you have a preview, use the table above for follow-ups. Export or download the code so you can run Lighthouse against a real URL, not only the editor preview.
- ChatGPT, Claude, Gemini: ask for "one HTML file with CSS included" so you can save it, open it locally, and tab through it. Preview inside the chat is not a keyboard test.
- Cursor, Windsurf, GitHub Copilot, OpenAI Codex: put the accessibility block in your rules file (
.cursor/rules,CLAUDE.md,AGENTS.mdor.github/copilot-instructions.md) so later section-by-section edits inherit it. Still say "include the accessibility constraints" in the request, because rules files are easy to ignore when the task is large.
None of these tools is "the accessible one." The prompt and the review are what change the outcome.
How do I run a 10-minute review before shipping?
- Keyboard only. Unplug the idea of a mouse. Can you reach every action, see focus at all times, and operate menus and dialogs with Escape, Enter and arrows?
- Zoom to 200%. Text should still wrap. Nothing important should clip or overlap.
- Lighthouse or axe, on a deployed preview, not just localhost if your fonts load differently in production.
- One screen-reader sample, even a short VoiceOver or NVDA pass on the hero, the form and the footer. Listen for the skip link, the
h1, and whether the primary button is announced with its label. - Real content. Replace
[PLACEHOLDER]and[ALT]before this review. Empty boxes hide contrast and labelling problems.
If a fix would change the brand colours, take it to the design tokens, not to a one-off override on a single button. Otherwise the next generated section will bring the old contrast back.
Where can I get section prompts that already include these constraints?
You can keep the block above in a snippet file and paste it yourself, which is what I do for one-off pages. If you generate a lot of pages and want starting points for common sections (forms, pricing, FAQs, headers) that you can adapt, that is what VibUI is for: 2,852 website prompt templates (775 full pages, 1,100 sections, 817 components and 160 animated backgrounds), and roughly 1,000 of those entries ship with source code. You pay once, and the plan does not renew by itself: $48 quarterly, $99 yearly, or $179 for lifetime access. Sixty samples are visible without paying, and a free login can copy 2 prompts, which is enough to judge the style. The accessibility review above is still required; a library does not replace a keyboard pass.
FAQ
Is WCAG 2.2 AA a realistic target for an AI-generated marketing page?
For a simple marketing or docs page, yes, if the constraints are in the first prompt and you review the result. Complex widgets (date pickers, custom selects, live filters) still need extra care and often a specialist review.
Should I ask the model to "make it WCAG compliant"?
That phrase is too vague. Models will claim compliance without checking contrast or keyboard behaviour. Spell out the rules, then measure.
Do I need a dark theme for accessibility?
No. You need sufficient contrast in the theme you actually ship. If you do offer dark mode, test both. A light theme that passes can fail when inverted carelessly.
What about cookie banners and chat widgets?
Third-party widgets are a common source of focus traps and unlabelled buttons. If you must add one, test it with the keyboard after it loads. Prefer a simple link to a policy page over a blocking pop-up on first paint.
Will this slow the build down?
The first prompt is a few extra lines. The keyboard and Lighthouse pass is about ten minutes. Reworking a finished visual design to fix structure usually takes longer.
