Skip to content
mentoor

Accessible AI-generated UI

For engineers

Scenario lesson and practice set combining Prototyping with AI, Accessibility checks with AI, Inclusive AI design and Reviewing AI-written code. Completing it counts as evidence for every listed skill.

The one-sentence idea: an AI tool can build a booking page that looks finished in ten minutes, but it will usually skip keyboard use, labels, error and loading states and screen reader support, so the page becomes accessible only when you scope the prototype, check it with real tools and people, test the AI feature itself, and review the code before it ships.

The case

Northwind Clinic wants patients to book appointments online. A developer, Priya, types one prompt into a prompt-to-UI tool (v0, Lovable, Bolt, Figma Make and a coding agent all work this way): "Build a booking page with a time picker, a patient form and an AI assistant that answers questions." Eight minutes later she has a running page. It looks good on her laptop. A week later the clinic's accessibility contact, who uses a screen reader, tries to book and cannot get past the second field.

Nothing about this is unusual. Generated interfaces copy the most common patterns on the web, and the most common patterns include clickable <div> elements, placeholder text used as a label, grey text on white and focus outlines removed because they "look messy". The model is not trying to exclude anyone. It is predicting what a booking page usually looks like, and the internet is full of inaccessible ones.

Why it matters

Accessibility failures are not a polish issue. A patient who cannot book by keyboard, or whose screen reader says "button" with no name, cannot use the service. In many places the law also expects it: WCAG 2.2 level AA is the usual target. And a prototype that gets copied into production carries its flaws with it, because nobody schedules the time to fix a page that "already works".

How to do it

  1. Scope the prototype. Name the one flow under test (find a slot, book it). Ask for realistic content, not "Lorem ipsum", and list the states: loading slots, no slots, booking failed, a name that wraps to three lines. Tell the tool to use semantic elements. Treat the result as a sketch, not a product.
  2. Check it with tools. Run an automated scan such as axe or Lighthouse, then check contrast with a real checker. A model's claim that two colours "have a ratio of 4.6:1" is a guess, not a measurement. WCAG 2.2 AA asks for at least 4.5:1 for normal text and 3:1 for large text and interface parts.
  3. Do a manual pass. Put the mouse away and use Tab, Shift+Tab, Enter, Space and Escape. Every control must be reachable, visibly focused and usable. Then listen to the page with a screen reader. Scans catch only part of the problems, so "no axe violations" never means "WCAG compliant".
  4. Test the AI feature itself. The assistant streams its answer word by word. A screen reader will say nothing unless new text lands in a live region, and announcing every token makes it unusable. Long answers need structure and plain language. Answers in Spanish or Arabic may be weaker than in English, and the interface should say so. Example prompts and personas should not assume one kind of patient.
  5. Review the code. Read the diff from the intent outward. Look for scope creep, such as a lint rule switched off or a test deleted to make a build pass. When an agent "fixes accessibility", check the fix: an aria-label that no longer contains the visible text breaks voice control.
  6. Decide keep, refactor or rebuild. Prototype code often contains keys in client files, endpoints without authentication and dependencies nobody vetted. Fix those before anything real touches the page.

Before and after

Before: <div class="btn" onClick={book}>Book 9:30</div>, an input whose only label is a placeholder, light grey hint text at 2.5:1, an assistant that streams into a plain <div>, and a summary from the tool that says "fully accessible".

After: a real <button type="button">, a visible <label> tied to each input, hint text at 4.5:1 or better, answers placed in a polite live region that announces once when complete, and a written test report that lists what was scanned, what was done by hand and who tried it.

What goes wrong

  • Trusting the tool's own report. The same model that wrote the page will tell you it is accessible. It has not run a screen reader.
  • Fixing the symptom. Adding role="button" to a div announces a button but does not make Enter and Space work.
  • Testing one output. The assistant gives a different answer every run. A test that passes once says little.
  • Merging a large diff by skimming. The risky change is often 38 lines in a server file, not the 400 generated lines of CSS.

Accessible AI-built UI is not a special skill. It is the ordinary habit of checking what was built against what real people can use.

Steps

  1. Scope the prototype to one flow

    Skill: design-prototyping

    Priya rewrites her prompt: only the find-and-book flow, realistic clinic content, semantic HTML, and the states loading, no slots, booking failed and a long patient name. The first version took eight minutes; the scoped one takes ten and survives a usability session.

    Revised prompt
    1. user

      Build the find-and-book flow for Northwind Clinic only. Use real elements (button, label, input). Show states: loading slots, no slots, booking failed, and a patient named 'Maria Fernanda de los Angeles Ortega-Villanueva'. No login yet.

  2. Scan and measure, do not ask

    Skill: design-accessibility

    Run axe, then check each colour pair in a contrast checker. A model's ratio claim is not evidence. Hint text at #9CA3AF on white measures 2.54:1 and fails the 4.5:1 AA minimum for normal text.

    Measured contrast
    ElementColoursRatioAA normal text (4.5:1)
    Hint text#9CA3AF on #FFFFFF2.54Fails
    Body text#1F2937 on #FFFFFF14.68Passes
    Primary button#FFFFFF on #2563EB5.17Passes
  3. Run a keyboard and screen reader pass

    Skill: design-accessibility

    Tab through the whole flow. The time slots are clickable divs that Tab skips, and the name field has only a placeholder. Replace the divs with buttons and add visible labels, then repeat the pass.

  4. Test the AI assistant, not just the page

    Skill: aiux-inclusive

    Check that streamed answers reach a screen reader once, in a polite live region. Check long answers for structure and plain language, and try Spanish questions, since quality there may be lower. Write a test plan with several user groups and run each task on more than one generated answer.

    Assistant test plan

    Goal: Find barriers before launch

    1. Screen reader user books a slot and asks the assistant about parking
    2. Keyboard-only user opens and closes the assistant
    3. Spanish speaker asks about fasting before a blood test
    4. Person with a learning disability reads the preparation answer
    5. Run each task on three different generated answers
  5. Review the diff from the intent outward

    Skill: aicode-review

    Read the task first, then the file list. Open the riskiest files before the largest. Look for turned-off lint rules, deleted tests and edits outside the flow. Check that every claimed accessibility fix really changes behaviour.

  6. Decide keep, refactor or rebuild

    Skill: design-prototyping

    Before real patients use it, remove the API key from the client file, put authentication in front of the booking endpoint, vet each added dependency and refactor the hard-coded colours into tokens. Rebuild any part that cannot be made accessible with small changes.

Skills this scenario uses

Where to study