/cursor-tutorials

How to generate accessible UI with Cursor

Learn how to generate accessible UI with Cursor using best practices that improve usability, inclusivity, and overall user experience.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to generate accessible UI with Cursor

You generate accessible UI in Cursor the same way you would in a normal VS Code workflow, but you use Cursor’s AI features to accelerate the work: you write normal, standards‑compliant HTML/ React components, and then use Cursor’s chat, inline diff, and multi‑file reasoning to audit accessibility, fix aria labels, improve keyboard navigation, and check color contrast. Cursor does not magically “produce” accessible UI; instead, it helps you refactor, review, and enforce accessibility across your existing files much faster and with less guesswork.

The core idea: you write or paste your UI code, then ask Cursor to improve it for accessibility in place. Cursor edits the local files, but it’s still your job to validate it with dev tools, screen readers, and linters like eslint‑plugin‑jsx-a11y.

 

What “accessible UI” actually means (in plain language)

 

Accessibility (often written as a11y) is about making your app usable by people with disabilities — for example blind users with screen readers, users who cannot use a mouse, or users with color‑vision impairments. In practical code terms, this usually means the following:

  • Proper semantic HTML (use <button>, <nav>, <header>, etc., not random <div> tags).
  • Correct aria attributes (like aria-label, role, aria-expanded).
  • Full keyboard support (tabbing, focus styles, Enter/Space interactions).
  • Readable color contrast (foreground vs background).
  • Alt text for meaningful images.

 

How to do this effectively inside Cursor

 

Below is a practical approach that developers actually use day‑to‑day when building accessible UI with Cursor.

  • Use inline AI edits
    Highlight a React component, hit Cmd+K (or right‑click “Edit in Cursor”), and ask: “Improve this component to meet WCAG accessibility standards. Keep layout unchanged.” Cursor will add aria‑labels, roles, keyboard events, etc.
  • Use multi-file instructions
    Open a few components, then tell Cursor in the sidebar: “Audit all currently opened files for semantic HTML and missing aria labels. Suggest minimal diffs only.”
  • Ask Cursor to refactor complex patterns
    If you have custom dropdowns, modals, tabs, etc., ask Cursor: “Refactor this custom dropdown to a fully accessible pattern following WAI‑ARIA practices.” It can rewrite to a compliant pattern.
  • Use real linters to verify
    Install eslint-plugin-jsx-a11y and let Cursor auto‑fix issues. Ask Cursor: “Fix all jsx-a11y errors project‑wide.” Cursor will apply code mods across files.
  • Use the terminal to run accessibility tooling
    You can run tools like axe-core with Jest or React Testing Library. Cursor understands the test results and can fix failures.

 

Example: Turning an inaccessible button into a proper accessible component using Cursor

 

Imagine you start with something like this:

 

// A button-like div (not accessible)
<div onClick={handleOpen} className="menu-trigger">
  Open Menu
</div>

 

In Cursor, you can highlight this and ask: “Convert this to an accessible button with keyboard support and proper attributes.” Cursor will rewrite it like this:

 

<button 
  type="button" 
  onClick={handleOpen} 
  className="menu-trigger"
>
  Open Menu
</button>

 

Or if it’s a custom component that needs ARIA attributes:

 

<button 
  type="button" 
  onClick={handleOpen} 
  className="menu-trigger"
  aria-haspopup="true"
  aria-expanded={isOpen}
>
  Open Menu
</button>

 

From here, you can ask Cursor: “Check the rest of this file for similar issues” and it will scan nearby components and propose patches.

 

Example: Making a custom modal accessible

 

If you have a modal built from <div> tags, ask Cursor to add:

  • role="dialog"
  • aria-modal="true"
  • Focus trapping
  • Escape key handling

Cursor can generate a working version like this:

 

import { useEffect, useRef } from "react";

function Modal({ isOpen, onClose, children }) {
  const ref = useRef(null);

  useEffect(() => {
    if (isOpen && ref.current) {
      ref.current.focus();        // Focus the modal container
    }
  }, [isOpen]);

  if (!isOpen) return null;

  return (
    <div 
      role="dialog"
      aria-modal="true"
      className="modal-backdrop"
      onClick={onClose}
    >
      <div
        className="modal-content"
        tabIndex={-1}             // Make container focusable
        ref={ref}
        onClick={(e) => e.stopPropagation()}   // Prevent closing on content click
        onKeyDown={(e) => {
          if (e.key === "Escape") onClose();   // Close on Esc
        }}
      >
        {children}
      </div>
    </div>
  );
}

export default Modal;

 

This is a fully valid and common React modal pattern. Cursor can generate this from a messy modal automatically, as long as you ask clearly.

 

How to check accessibility in Cursor (and fix with AI)

 

  • Run eslint-plugin-jsx-a11y
    Install it, run your linter, then ask Cursor: “Fix all accessibility lint errors.” Cursor rewrites only what’s needed.
  • Use browser dev tools
    Chrome’s Lighthouse accessibility audit works great. After the audit, copy the errors into Cursor and ask: “Fix these issues in the relevant components.”
  • Use screen reader tests
    NVDA (Windows), VoiceOver (Mac/iOS), or Narrator. After you find issues, describe them to Cursor and let it patch the code.
  • Use axe DevTools
    You can paste axe output directly into Cursor and say: “Fix these axe accessibility violations.”

 

Workflow summary (realistic, what devs actually do)

 

  • Write your UI normally (React, HTML, Tailwind, etc.).
  • Highlight a component → ask Cursor to improve accessibility.
  • Open multiple files → ask Cursor for an accessibility audit.
  • Run linters/tests → feed results back to Cursor for fixes.
  • Validate in the browser with Lighthouse/axe/screen readers.

This workflow produces genuinely accessible UI, while Cursor handles the repetitive or hard-to-remember details.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022