agentleFS
girijashankarjgirijashankarj/cursor-handbook/.cursor/rules/frontend/accessibility.mdc

cursor-handbook / frontend

Cursor rule31 starsChanged 3 months agoMITView on GitHub

Accessibility (a11y) rules for frontend components. Apply when editing UI or markup.

The file

Show its rules and text

We split this accessibility.mdc into the rules it gives an agent

15 rules. About 0 are common, 5 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use semantic elements: <nav>, <main>, <article>, <section>, <aside>

    line 12
  2. Very specific:

    Use heading hierarchy: <h1> → <h2> → <h3> (never skip levels)

    line 13
  3. Very specific:

    Use <button> for actions, <a> for navigation — never swap them

    line 14
  4. Very specific:

    Use <label> for all form inputs with htmlFor attribute

    line 15
  5. Very specific:

    Use <fieldset> and <legend> for related form groups

    line 16
  6. Very specific:

    Add aria-label to icon-only buttons

    line 19
  7. Very specific:

    Use aria-live regions for dynamic content updates

    line 20
  8. Very specific:

    Add role attributes when semantic HTML isn't sufficient

    line 21
  9. Very specific:

    Use aria-expanded for collapsible sections

    line 22
  10. Very specific:

    Use aria-describedby for complex form validation messages

    line 23
  11. Distinctive:

    All interactive elements MUST be keyboard accessible

    line 26
  12. Distinctive:

    Don't convey information through color alone — use icons or text

    line 34
  13. Distinctive:

    Test with keyboard navigation

    line 46
  14. Distinctive:

    Test with screen readers (VoiceOver, NVDA)

    line 47
  15. Distinctive:

    Use axe-core or Lighthouse for automated a11y audits

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
accessibility.mdc
---
description: "Accessibility (a11y) rules for frontend components. Apply when editing UI or markup."
alwaysApply: false
globs: "**/*.tsx,**/*.jsx,**/*.vue,**/components/**/*"
---

# Accessibility Rules

## WCAG 2.1 AA Compliance (Minimum)

### Semantic HTML
- Use semantic elements: `<nav>`, `<main>`, `<article>`, `<section>`, `<aside>`
- Use heading hierarchy: `<h1>` → `<h2>` → `<h3>` (never skip levels)
- Use `<button>` for actions, `<a>` for navigation — never swap them
- Use `<label>` for all form inputs with `htmlFor` attribute
- Use `<fieldset>` and `<legend>` for related form groups

### ARIA Attributes
- Add `aria-label` to icon-only buttons
- Use `aria-live` regions for dynamic content updates
- Add `role` attributes when semantic HTML isn't sufficient
- Use `aria-expanded` for collapsible sections
- Use `aria-describedby` for complex form validation messages

### Keyboard Navigation
- All interactive elements MUST be keyboard accessible
- Visible focus indicators on all focusable elements
- Logical tab order (avoid `tabIndex` > 0)
- Escape key closes modals and dropdowns
- Enter/Space activates buttons and links

### Visual
- Minimum contrast ratio: 4.5:1 for normal text, 3:1 for large text
- Don't convey information through color alone — use icons or text
- Support text zoom up to 200% without loss of content
- Provide text alternatives for all images: `alt` attribute
- Animated content must be pausable

### Forms
- Clear error messages linked to the field via `aria-describedby`
- Required fields marked with `aria-required="true"`
- Form validation errors announced to screen readers
- Autofill support for common fields (name, email, address)

### Testing
- Test with keyboard navigation
- Test with screen readers (VoiceOver, NVDA)
- Use axe-core or Lighthouse for automated a11y audits
- Include a11y tests in CI pipeline

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.