Cursor rule
.cursor/rules/global-accessibility-standards.mdcGlobal scope accessibility standards per WCAG requirements for page language, viewport, title attributes, and skip links
Cursor rules
Quality
36/100
Scores the file, not the repository.Length
1,328 words
1 headings · 7 code blocksRepository
428
— · pushed 17 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Global Scope Accessibility Standards89Ensures global accessibility best practices are followed including page language, viewport meta tag, title attribute usage, and skip link implementation for WCAG compliance.1011<rule>12name: global_accessibility_standards13description: Enforce global scope accessibility standards per WCAG requirements for page language, viewport, title attributes, and skip links14filters:15 - type: file_extension16 pattern: "\\.(vue|jsx|tsx|html|liquid|php|js|ts)$"1718actions:19 - type: enforce20 conditions:21 # Missing lang attribute on html element22 - pattern: "<html[^>]*>"23 pattern_negate: "lang=\"[a-z]{2}(?:-[A-Z]{2})?\""24 message: "HTML element must have lang attribute set to ensure proper pronunciation by assistive technology. Use lang=\"en\" for English or appropriate language code."2526 # Invalid language code format27 - pattern: "lang=\"[^a-z]{2}(?:-[^A-Z]{2})?\""28 message: "Language code must follow ISO 639-1 format (e.g., lang=\"en\", lang=\"fr-CA\")."2930 # Missing viewport meta tag31 - pattern: "<head[^>]*>"32 pattern_negate: "<meta[^>]*name=\"viewport\""33 message: "Viewport meta tag is required for responsive design and accessibility. Include <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">."3435 # Viewport meta tag preventing zoom36 - pattern: "<meta[^>]*name=\"viewport\"[^>]*>"37 pattern_negate: "(maximum-scale=1\\.0|user-scalable=no)"38 message: "Viewport meta tag should not prevent zooming. Avoid maximum-scale=1.0 and user-scalable=no to maintain accessibility for low-vision users."3940 # Problematic viewport attributes41 - pattern: "(maximum-scale=1\\.0|user-scalable=no)"42 message: "Viewport meta tag contains attributes that prevent zooming, which creates accessibility issues for low-vision users. Remove maximum-scale=1.0 and user-scalable=no."4344 # Title attribute on non-iframe elements45 - pattern: "(?i)<[^>]*title=\"[^\"]+\"[^>]*>"46 pattern_negate: "(iframe|IFRAME)"47 message: "Avoid using title attribute on non-iframe elements as it creates accessibility issues. Use visible text, aria-label, or custom tooltips instead."4849 # Missing title on iframe elements50 - pattern: "<iframe[^>]*>"51 pattern_negate: "title=\"[^\"]+\""52 message: "Iframe elements must have title attribute to provide context for screen reader users."5354 # Empty or meaningless iframe title55 - pattern: "<iframe[^>]*title=\"\\s*(?:iframe|frame|content|page)\\s*\"[^>]*>"56 message: "Iframe title should be descriptive and meaningful, not generic terms like 'iframe' or 'content'."5758 # Missing skip link59 - pattern: "<body[^>]*>"60 pattern_negate: "<a[^>]*href=\"#[^\"]*\"[^>]*(?:skip|main|content)"61 message: "Skip link is required for keyboard navigation accessibility. Add a skip link at the top of the page to bypass repeated content."6263 # Skip link not at top of page64 - pattern: "<a[^>]*href=\"#[^\"]*\"[^>]*(?:skip|main|content)[^>]*>"65 pattern_negate: "(<body|<header|<nav)"66 message: "Skip link should be one of the first elements in the document, typically within the header or at the top of the body."6768 # Skip link without proper target69 - pattern: "<a[^>]*href=\"#[^\"]*\"[^>]*(?:skip|main|content)[^>]*>"70 pattern_negate: "href=\"#(main|content|primary|skip-content)\""71 message: "Skip link href should target main content area (e.g., href=\"#main\")."7273 # Skip link target missing tabindex74 - pattern: "<a[^>]*href=\"#(main|content|primary|skip-content)\"[^>]*>"75 pattern_negate: "<(main|div|section)[^>]*id=\"(main|content|primary|skip-content)\"[^>]*tabindex=\"-1\""76 message: "Skip link target element must have tabindex=\"-1\" to receive keyboard focus when skip link is activated."7778 # Skip link without proper CSS classes79 - pattern: "<a[^>]*href=\"#[^\"]*\"[^>]*(?:skip|main|content)[^>]*>"80 pattern_negate: "(class=\"[^\"]*(?:visuallyhidden|sr-only|skip-link)[^\"]*\"|style=\"[^\"]*(?:position:\\s*absolute|clip:\\s*rect|overflow:\\s*hidden)[^\"]*\")"81 message: "Skip link should have CSS classes or styles to hide it visually while keeping it accessible to screen readers and keyboard users."8283 # Skip link not properly hidden84 - pattern: "<a[^>]*href=\"#[^\"]*\"[^>]*(?:skip|main|content)[^>]*>"85 pattern_negate: "(display:\\s*none|visibility:\\s*hidden)"86 message: "Skip link should not use display:none or visibility:hidden as these hide it from screen readers. Use visuallyhidden or sr-only classes instead."8788 - type: suggest89 message: |90 **Global Scope Accessibility Best Practices:**9192 **1. Page Language (WCAG 3.1.1 Language of Page):**93```html94 <!-- Good: Proper language declaration -->95 <!DOCTYPE html>96 <html lang="en">97 <head>98 <title>Page Title</title>99 </head>100 <body>101 <!-- Content in English -->102 </body>103 </html>104105 <!-- Good: Language toggle with proper lang attributes -->106 <nav>107 <a href="/en" lang="en">English</a>108 <a href="/fr" lang="fr">Français</a>109 </nav>110111 <!-- Good: Mixed language content -->112 <p>Welcome to our site. <span lang="fr">Bienvenue sur notre site.</span></p>113```114115 **Language Code Requirements:**116 - **Primary language:** Set on `<html>` element117 - **Format:** ISO 639-1 (e.g., `lang="en"`, `lang="fr-CA"`)118 - **Mixed content:** Use `lang` attribute on specific elements119 - **Purpose:** Enables proper pronunciation by assistive technology120121 **2. Viewport Meta Tag (WCAG 1.3.3 Sensory Characteristics):**122```html123 <!-- Good: Accessible viewport meta tag -->124 <meta name="viewport" content="width=device-width, initial-scale=1.0">125126 <!-- Good: With additional accessibility features -->127 <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=5.0">128129 <!-- Bad: Prevents zooming (accessibility issue) -->130 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">131```132133 **Viewport Requirements:**134 - **Required:** Must be present for responsive design135 - **Zoom support:** Must allow users to zoom content136 - **Avoid:** `maximum-scale=1.0` and `user-scalable=no`137 - **Purpose:** Enables low-vision users to zoom content138139 **3. Title Attribute (General Avoidance):**140```html141 <!-- Bad: Title attribute on non-iframe elements -->142 <button title="Click to submit form">Submit</button>143 <a href="/help" title="Get help with your account">Help</a>144145 <!-- Good: Visible text instead of title -->146 <button>Submit form</button>147 <a href="/help">Get help with your account</a>148149 <!-- Good: Custom accessible tooltip -->150 <button aria-describedby="submit-tooltip">Submit</button>151 <div id="submit-tooltip" class="tooltip" role="tooltip">152 Click to submit your form153 </div>154```155156 **Title Attribute Guidelines:**157 - **Avoid:** On interactive elements, links, buttons158 - **Exception:** Required on iframe elements159 - **Alternatives:** Visible text, aria-label, aria-describedby160 - **Issues:** Mouse-only, screen reader redundancy, low-vision interference161162 **4. Iframe Title Requirements:**163```html164 <!-- Good: Iframe with descriptive title -->165 <iframe166 src="https://example.com/embed"167 title="Interactive map showing store locations across the city"168 width="600"169 height="400">170 </iframe>171172 <!-- Good: Iframe with meaningful title -->173 <iframe174 src="https://example.com/calendar"175 title="Company event calendar for December 2024"176 width="100%"177 height="500">178 </iframe>179180 <!-- Bad: Generic or meaningless title -->181 <iframe182 src="https://example.com/embed"183 title="iframe"184 width="600"185 height="400">186 </iframe>187```188189 **Iframe Accessibility:**190 - **Required:** Title attribute for context191 - **Content:** Descriptive explanation of iframe purpose192 - **Screen readers:** Need context before entering frame193 - **Navigation:** Ctrl+Opt+Shift+Down to enter iframe (VoiceOver)194195 **5. Skip Link Implementation (WCAG 2.4.1 Bypass Blocks):**196```html197 <!-- Good: Skip link at top of page -->198 <body>199 <a href="#main" class="skip-link visuallyhidden focusable">200 Skip to main content201 </a>202203 <header>204 <nav>205 <!-- Navigation content -->206 </nav>207 </header>208209 <main id="main" tabindex="-1">210 <h1>Page Title</h1>211 <!-- Main content -->212 </main>213 </body>214```215216 **Skip Link Requirements:**217 - **Position:** First element in document (after body)218 - **Target:** Main content area with matching ID219 - **Focus:** Target element must have `tabindex="-1"`220 - **Styling:** Hidden visually, visible on focus221 - **Purpose:** Bypass repeated navigation content222223 **6. Skip Link CSS Implementation:**224```css225 /* Visually hidden but accessible */226 .visuallyhidden {227 position: absolute;228 width: 1px;229 height: 1px;230 padding: 0;231 margin: -1px;232 overflow: hidden;233 clip: rect(0, 0, 0, 0);234 white-space: nowrap;235 border: 0;236 }237238 /* Show on focus for keyboard users */239 .focusable:focus {240 position: static;241 width: auto;242 height: auto;243 padding: 8px 16px;244 margin: 0;245 overflow: visible;246 clip: auto;247 white-space: normal;248 background: #000;249 color: #fff;250 text-decoration: none;251 border-radius: 4px;252 z-index: 1000;253 }254255 /* Alternative: Screen reader only class */256 .sr-only {257 position: absolute;258 left: -10000px;259 width: 1px;260 height: 1px;261 overflow: hidden;262 }263```264265 **Skip Link Best Practices:**266 - **Target elements:** `<main>`, `<h1>`, or main content container267 - **Focus management:** Use `tabindex="-1"` on target268 - **Visual feedback:** Show link when it receives focus269 - **Positioning:** Place at very top of document270 - **Text:** Clear and descriptive (e.g., "Skip to main content")271272 **7. Complete Implementation Example:**273```html274 <!DOCTYPE html>275 <html lang="en">276 <head>277 <meta charset="UTF-8">278 <meta name="viewport" content="width=device-width, initial-scale=1.0">279 <title>Accessible Web Page</title>280 <style>281 .skip-link {282 position: absolute;283 top: -40px;284 left: 6px;285 background: #000;286 color: #fff;287 padding: 8px;288 text-decoration: none;289 border-radius: 4px;290 z-index: 1000;291 }292 .skip-link:focus {293 top: 6px;294 }295 </style>296 </head>297 <body>298 <!-- Skip link -->299 <a href="#main" class="skip-link">Skip to main content</a>300301 <!-- Header -->302 <header role="banner">303 <h1>Company Name</h1>304 <nav role="navigation" aria-label="Primary">305 <ul>306 <li><a href="/">Home</a></li>307 <li><a href="/about">About</a></li>308 <li><a href="/contact">Contact</a></li>309 </ul>310 </nav>311 </header>312313 <!-- Main content -->314 <main id="main" role="main" tabindex="-1">315 <h2>Welcome to Our Site</h2>316 <p>This is the main content area that the skip link targets.</p>317318 <!-- Iframe example -->319 <iframe320 src="https://example.com/embed"321 title="Interactive product demonstration video"322 width="100%"323 height="400">324 </iframe>325 </main>326327 <!-- Footer -->328 <footer role="contentinfo">329 <p>© 2024 Company Name</p>330 </footer>331 </body>332 </html>333```334335 **Testing and Validation:**336 - **Language:** Verify lang attribute is set correctly337 - **Viewport:** Test zoom functionality on mobile devices338 - **Title attributes:** Check for unnecessary usage on non-iframe elements339 - **Iframe titles:** Verify descriptive titles for all iframes340 - **Skip links:** Test keyboard navigation and focus management341 - **Screen readers:** Verify skip link announces correctly342 - **Focus order:** Ensure skip link target receives focus properly343344 **Common Mistakes to Avoid:**345 - Missing lang attribute on html element346 - Viewport meta tag preventing zoom347 - Using title attributes on interactive elements348 - Missing or generic iframe titles349 - Skip link not positioned at top of page350 - Skip link target without tabindex="-1"351 - Skip link hidden with display:none352 - Skip link not visible on focus353 - Generic skip link text354 - Skip link targeting wrong element355356metadata:357 priority: high358 version: 1.0359</rule>360
Also in Shopify/horizon
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Shopify/horizon.cursor/rules/accordion-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/animation-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/blocks.mdc · 428 | Cursor rules | stylearchtypesdatabase+2 | 62/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/breadcrumb-accessibility.mdc · 428 | Cursor rules | ui | 36/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/carousel-accessibility.mdc · 428 | Cursor rules | ui | 32/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/cart-drawer-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/chat-window-accessibility.mdc · 428 | Cursor rules | styleui | 24/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/color-contrast-accessibility.mdc · 428 | Cursor rules | lint-formatui | 44/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/color-swatch-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/commit-messages.mdc · 428 | Cursor rules | setuplint-formattypesgit | 62/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/css-standards.mdc · 428 | Cursor rules | stylearchuiperformance+3 | 49/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/disclosure-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/dropdown-navigation-accessibility.mdc · 428 | Cursor rules | styleui | 36/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/flip-card-accessibility.mdc · 428 | Cursor rules | styleui | 36/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/form-accessibility.mdc · 428 | Cursor rules | ui | 32/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/javascript-standards.mdc · 428 | Cursor rules | stylearchtypesui+2 | 54/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/landmark-accessibility.mdc · 428 | Cursor rules | ui | 40/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/liquid.mdc · 428 | Cursor rules | buildstyletypesdatabase+2 | 77/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/locales.mdc · 428 | Cursor rules | arch | 49/100 | 3 days ago | |
| Shopify/horizon.cursor/rules/localization.mdc · 428 | Cursor rules | style | 54/100 | 3 days ago |
Diff against .cursor/rules/accordion-accessibility.mdc Diff against .cursor/rules/animation-accessibility.mdc Diff against .cursor/rules/blocks.mdc Diff against .cursor/rules/breadcrumb-accessibility.mdc Diff against .cursor/rules/carousel-accessibility.mdc Diff against .cursor/rules/cart-drawer-accessibility.mdc Diff against .cursor/rules/chat-window-accessibility.mdc Diff against .cursor/rules/color-contrast-accessibility.mdc Diff against .cursor/rules/color-swatch-accessibility.mdc Diff against .cursor/rules/commit-messages.mdc Diff against .cursor/rules/css-standards.mdc Diff against .cursor/rules/disclosure-accessibility.mdc Diff against .cursor/rules/dropdown-navigation-accessibility.mdc Diff against .cursor/rules/flip-card-accessibility.mdc Diff against .cursor/rules/form-accessibility.mdc Diff against .cursor/rules/javascript-standards.mdc Diff against .cursor/rules/landmark-accessibility.mdc Diff against .cursor/rules/liquid.mdc Diff against .cursor/rules/locales.mdc Diff against .cursor/rules/localization.mdc
