# Text Quality Reviewer reference: Detection Rules Part of the `text-quality-reviewer` skill. Read this only when the task reaches these sections. ## Detection Rules ### TQR-001: Template Variables in Non-Visual Text (Critical) Detects unresolved template variable syntax in accessible names. **Patterns detected:** - Positional: `{0}`, `{1}`, `{2}` - Named braces: `{{variable}}`, `{{user.name}}` - Expression syntax: `${expression}`, `${item.title}` - Printf-style: `%s`, `%d`, `%1$s` - Object interpolation: `{property.name}`, `{item.altText}` - Angular: `{{ expression }}` - ERB/EJS: `<%= variable %>` ```html {hero.altText} Hi! Mountain landscape at sunset Welcome, Maria ``` ### TQR-002: Code Syntax in Non-Visual Text (Critical) Detects programming language syntax used as accessible names. **Patterns detected:** - Dot-separated identifiers: `property.altText`, `item.description.value` - CamelCase or PascalCase identifiers: `heroImageAlt`, `ButtonLabel` - Snake_case identifiers: `image_alt_text`, `btn_label` - Array/bracket syntax: `items[0]`, `data['key']` - Function calls: `getAltText()`, `t('key')` - HTML entities used as content: `&`, `<`, `'` ```html product.altText heroImageAlt Red running shoes, side view Summer sale: 30 percent off all items ``` ### TQR-003: Placeholder Text as Labels (Serious) Detects common placeholder, test, or filler text used as accessible names. **Strings flagged (case-insensitive):** - Development: `TODO`, `FIXME`, `TBD`, `PLACEHOLDER`, `TEMP`, `TEST`, `TESTING` - Filler: `lorem ipsum`, `asdf`, `xxx`, `yyy`, `foo`, `bar`, `baz`, `sample`, `example text` - Generic: `untitled`, `no title`, `none`, `N/A`, `null`, `undefined`, `empty` - Default: `image`, `photo`, `picture`, `icon`, `logo`, `banner` (without further description) - Repeated characters: `aaa`, `123`, `...` ```html TODO placeholder image Team collaborating at a whiteboard Quarterly revenue chart showing 15 percent growth The engineering team at the 2025 offsite ``` ### TQR-004: Attribute Name as Its Own Value (Critical) Detects when the attribute name or its role is used as the value. **Patterns detected:** - `alt="alt text"`, `alt="alt"`, `alt="alternative text"` - `aria-label="aria label"`, `aria-label="ARIA Label"`, `aria-label="label"` - `aria-label="button"`, `aria-label="link"`, `aria-label="input"` - `title="title"`, `aria-describedby` target text that says "description" - Button text that is just the element role: "Button", "Link", "Checkbox" ```html alt text Settings Monthly active users, January through June 2025 Account settings ``` ### TQR-005: Empty or Whitespace-Only Accessible Names (Critical) Detects accessible names that are present but contain no meaningful content. This is different from a missing `alt` attribute (caught by alt-text-headings). These have the attribute but it contains only whitespace, invisible characters, or zero-width spaces. ```html  ​ Quarterly sales comparison chart Revenue growth trend for Q1 2025 ``` ### TQR-006: Duplicate Accessible Names on Different Controls (Serious) Detects multiple interactive controls on the same page that share identical accessible names but perform different actions. ```html ``` ### TQR-007: Filename or File Path as Alt Text (Serious) Detects file names, paths, or hashes used as image alt text. **Patterns detected:** - File extensions: `*.jpg`, `*.png`, `*.gif`, `*.svg`, `*.webp`, `*.avif`, `*.bmp` - Path separators: text containing `/` or `\` followed by a filename - CMS hash names: `DSC_0492.jpg`, `IMG_2847.jpg`, `photo-1234567890.webp` - UUID/hash patterns: `a1b2c3d4-e5f6.png` ```html DSC_0492.jpg hero-banner.png /media/photo-1234567890.webp Sunset over the Golden Gate Bridge Welcome to our accessible design system A developer using a screen reader to test a web form ``` ### TQR-008: Single-Character or Extremely Short Labels (Moderate) Detects accessible names that are a single character or extremely short (under 3 characters for non-icon elements). **Exceptions (NOT flagged):** - Icon buttons with standard single-character symbols when `aria-label` provides the full description - Buttons with visible text like "X" when `aria-label` says "Close" - Pagination: "1", "2", "3" when properly labeled with `aria-label` ```html i No data Information about this feature No data ``` ### TQR-009: Visible Text Contradicts Accessible Name (Serious) Detects when `aria-label` or `aria-labelledby` provides an accessible name that conflicts with or does not contain the visible text. This violates WCAG 2.5.3 (Label in Name) and breaks speech-input navigation. ```html Settings Settings ``` ### TQR-010: Dynamic Content Showing Raw Data or Zero State (Moderate) Detects patterns that suggest dynamic content failed to populate, leaving raw data structures, zero values, or default states visible as accessible names. **Patterns detected:** - Zero-state numbers that suggest unloaded data: "0 innings", "0 items", "$0.00" in contexts where zero makes no sense - Raw JSON keys or API field names in visible text - Bracket notation suggesting failed rendering: `[object Object]`, `[undefined]` ```html Score

Player stats

Score: top of the 3rd inning

Player stats: season batting average .312

```