Accessibility Guard — Cursor Rules | Neura Market
    Neura MarketNeura Market/Cursor
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityExtensionsTrendingGenerate
    CursorRulesAccessibility Guard
    Back to Rules
    Frontend

    Accessibility Guard

    April 15, 2026
    0 copies 0 downloads

    <IconButton aria-label="Close dialog">

    Rule Content
    You are an expert in web accessibility (WCAG 2.2). Treat a11y violations as compile errors.
    
    ## Required Patterns
    
    ### Icon Buttons
    ```typescript
    // ✅ Required
    <IconButton aria-label="Close dialog">
      <CloseIcon />
    </IconButton>
    
    // ❌ Violation - blocks PR
    <IconButton>
      <CloseIcon />
    </IconButton>
    ```
    
    ### Custom Interactive Elements
    ```typescript
    // ✅ Required for non-button clickable elements
    <div 
      role="button" 
      tabIndex={0}
      onKeyDown={handleKeyDown}
      onClick={handleClick}
      aria-pressed={isActive}
    >
      Toggle
    </div>
    ```
    
    ### Images
    ```typescript
    // ✅ Meaningful images
    <img src="chart.png" alt="Q4 sales increased 25%" />
    
    // ✅ Decorative images
    <img src="decoration.png" alt="" role="presentation" />
    
    // ❌ Missing alt
    <img src="chart.png" />
    ```
    
    ### Form Fields
    ```typescript
    // ✅ Associated label
    <label htmlFor="email">Email</label>
    <input id="email" type="email" />
    
    // ✅ Or aria-label
    <input aria-label="Search products" type="search" />
    ```
    
    ### Error Announcements
    ```typescript
    // ✅ Announce errors to screen readers
    <div role="alert" aria-live="polite">
      {error && <span>{error}</span>}
    </div>
    ```
    
    ### Focus Management
    ```typescript
    // ✅ Visible focus indicator
    :focus-visible {
      outline: 2px solid #0066cc;
      outline-offset: 2px;
    }
    
    // ❌ Never do this
    :focus {
      outline: none;
    }
    ```
    
    ### Modal Focus Trap
    ```typescript
    // ✅ Required for modals
    useEffect(() => {
      const modal = modalRef.current;
      const focusableElements = modal.querySelectorAll(
        'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
      );
      const firstElement = focusableElements[0];
      const lastElement = focusableElements[focusableElements.length - 1];
      
      firstElement?.focus();
      // Trap focus within modal
    }, [isOpen]);
    ```
    
    ### Keyboard Navigation
    ```typescript
    // ✅ Support keyboard
    onKeyDown={(e) => {
      if (e.key === 'Enter' || e.key === ' ') {
        handleAction();
      }
      if (e.key === 'Escape') {
        handleClose();
      }
    }}
    ```
    
    ## WCAG 2.2 New Requirements
    
    - **2.5.8 Target Size**: Minimum 24x24 CSS pixels
    - **2.4.12 Focus Not Obscured**: Focus indicator not hidden
    - **3.3.7 Redundant Entry**: Don't ask for same info twice

    Tags

    accessibilitywcaga11yreacttypescript

    Comments

    More Rules

    View all
    Web Development

    Next.js 15 + TypeScript Cursor Rules

    Comprehensive .cursorrules file for Next.js 15 App Router projects with TypeScript, enforcing server components by default, proper use of "use client" directive, and App Router conventions.

    C
    Community
    Backend Development

    Python FastAPI Best Practices Rules

    Cursor rules for Python FastAPI projects enforcing async patterns, Pydantic v2 models, dependency injection, and proper error handling.

    C
    Community
    Frontend Development

    React + TypeScript Component Rules

    Rules for consistent React component development with TypeScript interfaces, proper hook patterns, and component composition.

    C
    Community
    AI/ML

    Cursor Agent Mode Configuration

    Rules optimizing Cursor Agent mode behavior including multi-file editing context, session management, and autonomous task completion patterns.

    C
    Cursor Team
    Frontend Development

    Tailwind CSS + shadcn/ui Rules

    Cursor rules for projects using Tailwind CSS with shadcn/ui component library, enforcing consistent utility class usage and component patterns.

    C
    Community
    Backend Development

    Go Backend Service Rules

    Rules for Go backend services enforcing idiomatic Go patterns, proper error handling, and clean architecture conventions.

    C
    Community

    Stay up to date

    Get the latest Cursor prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Cursor and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.