agentleFS
ivangrynenkoivangrynenko/cursorrules/.cursor/rules/accessibility-standards.mdc

cursorrules / rules

Cursor rule88 starsChanged 13 months agoMITView on GitHub

WCAG compliance and accessibility best practices

The file

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

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Heading Hierarchy: Use headings (h1 to h6) in a logical order to structure content.

    line 30
  2. Distinctive:

    Keyboard Navigation: Ensure all interactive elements are accessible via keyboard.

    line 31
  3. Distinctive:

    Color Contrast: Check color contrast ratios meet WCAG guidelines (4.5:1 for normal text, 7:1 for large text).

    line 33
  4. Distinctive:

    Focus Management: Ensure focus indicators are visible and manage focus for modal dialogs or dynamic content changes.

    line 35
  5. Distinctive:

    Descriptive Links: Use descriptive text for links, avoiding generic phrases like "click here."

    line 37
  6. Distinctive:

    Touch Targets: Ensure touch target sizes are large enough (at least 44x44 pixels) for mobile users.

    line 38
  7. Distinctive:

    Timeouts: Avoid or provide options to extend time limits where possible, or warn users before session expiry.

    line 39

≈ “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-standards.mdc
---
description: WCAG compliance and accessibility best practices
globs: *.vue, *.jsx, *.tsx, *.html, *.php
---
# Accessibility Standards

Ensures WCAG compliance and accessibility best practices.

## Rule Details

- **Name:** accessibility_standards

- **Description:** Enforce accessibility standards and WCAG compliance

## Filters
- file extension pattern: `"\\.(vue|jsx|tsx|html|php|css|scss|sass)$" # Expanded to include CSS files`

## Enforcement Checks
- Conditions:
  - pattern `<img[^>]+(?!alt=)[^>]*>` – Images must have alt attributes for screen readers.
  - pattern `aria-[a-z]+=\"\"` – ARIA attributes should not be empty; provide meaningful values.
  - pattern `<button[^>]*>(?![^<]*[^\\s])[^<]*</button>` – Buttons should have meaningful, descriptive content.
  - pattern `<a[^>]*href=\"#[^\"]*\"[^>]*>(?![^<]*<svg)[^<]*</a>` – Links with href='#' should either be removed or have an aria-label for context.
  - pattern `<input[^>]+type=\"(text|email|password|search|tel|url)\"[^>]*>` – negated `aria-label|aria-labelledby|title` – Form inputs should include an aria-label or aria-labelledby attribute for better screen reader support.
  - pattern `<video[^>]*>(?!<track)[^<]*</video>` – Videos should include captions for accessibility.

## Suggestions
- Guidance:
**Accessibility Best Practices:**
- **Heading Hierarchy:** Use headings (h1 to h6) in a logical order to structure content.
- **Keyboard Navigation:** Ensure all interactive elements are accessible via keyboard.
- **Semantic HTML:** Favor semantic elements like <nav>, <article>, <section>, and <aside> for better structure comprehension.
- **Color Contrast:** Check color contrast ratios meet WCAG guidelines (4.5:1 for normal text, 7:1 for large text).
- **Skip Navigation Links:** Provide 'skip to main content' links for keyboard users to bypass repetitive navigation.
- **Focus Management:** Ensure focus indicators are visible and manage focus for modal dialogs or dynamic content changes.
- **Form Labels:** Associate labels with form controls using the 'for' attribute or wrap controls with <label>.
- **Descriptive Links:** Use descriptive text for links, avoiding generic phrases like "click here."
- **Touch Targets:** Ensure touch target sizes are large enough (at least 44x44 pixels) for mobile users.
- **Timeouts:** Avoid or provide options to extend time limits where possible, or warn users before session expiry.
- **Language Attribute:** Set the lang attribute on the <html> element to indicate the primary language of the page.

## Metadata
- Priority: high
- Version: 1.2

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.