Aller au contenu principal

Rules: accessibility

IMPORTANT: Every image must have an alt attribute. IMPORTANT: Every form must have associated labels. IMPORTANT: The site must be 100% keyboard navigable. IMPORTANT: ARIA attributes must be valid and

Affected files

These rules apply to files matching the following patterns:

  • **/*.tsx
  • **/*.jsx
  • **/components/**
  • **/pages/**
  • **/app/**

Detailed rules

Accessibility Rules (WCAG 2.1/2.2 AA)

Impact levels (inspired by axe-core)

LevelDefinitionAction
CriticalCompletely blocks accessFix immediately
SeriousSignificant impact on usabilityFix before release
ModerateHinders user experienceSchedule fix
MinorDesirable improvementBacklog

1. Images and media

RuleImpactWCAG
Every <img> must have an alt attributeCritical1.1.1
Decorative images: alt="" with role="presentation"Serious1.1.1
SVG with role="img" must have aria-label or <title>Serious1.1.1
<input type="image"> must have altCritical1.1.1
<object> and <embed> must have alternative textSerious1.1.1
<area> in image maps must have altCritical1.1.1
Videos must have captions (<track kind="captions">)Critical1.2.2
No autoplay audio (or stop control)Serious1.4.2

2. Forms

RuleImpactWCAG
Every input must have an associated <label> (htmlFor or nesting)Critical4.1.2
<select> must have an accessible nameCritical4.1.2
Errors must use aria-invalid and role="alert"Serious3.3.1
Hints with aria-describedbyModerate3.3.2
Valid and relevant autocomplete attributesModerate1.3.5
No multiple labels on the same fieldModerate4.1.2

3. Keyboard navigation

RuleImpactWCAG
Visible focus required (:focus-visible with outline)Serious2.4.7
Never use positive tabIndexSerious2.4.3
Site 100% keyboard navigableCritical2.1.1
No keyboard trap (focus must not get stuck)Critical2.1.2
"Skip to content" link at the start of the pageSerious2.4.1
Scrollable areas must be focusableSerious2.1.1
No nested interactive elements (button inside button)Serious4.1.2
RuleImpactWCAG
Buttons must have accessible textCritical4.1.2
Icon buttons must have aria-labelCritical4.1.2
Descriptive links (not "click here")Serious2.4.4
External links: indicate new tab opening via sr-onlyModerate2.4.4
Links within a text block distinguishable without color aloneSerious1.4.1

5. Colors and contrast

RuleImpactWCAG
Normal text: minimum ratio 4.5:1Serious1.4.3
Large text (18px+ or 14px+ bold): minimum ratio 3:1Serious1.4.3
UI elements and graphics: minimum ratio 3:1Serious1.4.11
Never use color as the sole indicatorSerious1.4.1

6. ARIA

RuleImpactWCAG
Only ARIA attributes allowed for the role usedCritical4.1.2
Required ARIA attributes present according to the roleCritical4.1.2
No prohibited ARIA attributes for the roleSerious4.1.2
Valid ARIA attribute valuesCritical4.1.2
Valid ARIA roles (no invented role)Critical4.1.2
No deprecated ARIA rolesModerate4.1.2
aria-hidden="true" must not be on focusable elementsCritical4.1.2
aria-hidden="true" forbidden on <body>Critical4.1.2
ARIA parent/child relationships respected (e.g., listbox > option)Serious1.3.1
Named ARIA components: dialog, meter, progressbar, tooltipSerious4.1.2

7. Structure and semantics

RuleImpactWCAG
<html> must have a valid lang attributeSerious3.1.1
<title> non-empty and descriptiveSerious2.4.2
Heading hierarchy respected (no jump from h1 to h3)Moderate1.3.1
Non-empty headingsSerious2.4.6
Page contains an <h1>Moderate1.3.1
Landmarks (<main>, <nav>, <header>, <footer>) usedModerate1.3.1
Landmarks of the same type have a unique label (aria-label)Moderate2.4.1
All page content within a landmark (<main>)Moderate1.3.1
Lists structured correctly (<ul>/<ol> > <li>)Moderate1.3.1
Language of foreign passages marked (lang on the element)Minor3.1.2

8. Tables

RuleImpactWCAG
Data tables must have <th>Serious1.3.1
<th> must have a scope attribute (col/row)Serious1.3.1
<td headers=""> must reference existing <th>Serious1.3.1
<th> must not be emptySerious1.3.1
<caption> and summary must not be identicalMinor1.3.1

9. Frames and iframes

RuleImpactWCAG
Every <iframe> must have a title attributeSerious4.1.2
Iframe titles unique within the pageModerate4.1.2
Iframe with focusable content must not have tabindex="-1"Serious2.1.1

10. Deprecated and dangerous elements

RuleImpactWCAG
Do not use <blink>Serious2.2.2
Do not use <marquee>Serious2.2.2
No <meta http-equiv="refresh"> with delaySerious2.2.1
No autoplay audio/video without controlSerious1.4.2

11. WCAG 2.2

RuleImpactWCAG
Touch targets minimum 44x44px (buttons, links, inputs)Serious2.5.8
Focus must not be obscured by other elementsSerious2.4.11

IMPORTANT rules

IMPORTANT: Every image must have an alt attribute. IMPORTANT: Every form must have associated labels. IMPORTANT: The site must be 100% keyboard navigable. IMPORTANT: ARIA attributes must be valid and allowed for the role. YOU MUST respect WCAG AA contrast ratios. YOU MUST use semantic landmarks (main, nav, header, footer). NEVER use color as the sole indicator of information. NEVER remove visible focus without an alternative. NEVER set aria-hidden="true" on a focusable element. NEVER use deprecated elements (blink, marquee).

Automatic application

These rules are automatically applied by Claude during:

  • Reading the matching files
  • Modifying code
  • Suggestions and fixes

See also