# Anti-Patterns Common mistakes that produce generic, broken, or inaccessible patterns. ## Design Quality Checklist - [ ] **Not generic**: pattern makes at least 3 distinctive design choices - [ ] **Layout variety**: not defaulting to 3 equal columns or uniform symmetric layouts - [ ] **Color rhythm**: sections alternate or vary backgrounds — not all the same - [ ] **Typography contrast**: headings clearly distinct from body (size, family, or weight) - [ ] **Spatial intention**: padding and gaps vary by context, not uniform everywhere - [ ] **Meaningful content**: placeholder text reflects real use, buttons describe actions - [ ] **Specific structure**: comparisons, timelines, schedules, pricing, menus, and documentation cards have labels that make sense without relying on visual position alone - [ ] **Restrained but distinctive**: corporate/professional patterns still include a clear hierarchy, accent, or layout choice; playful patterns do not become a one-note palette or repeated gradient treatment ## Technical Anti-Patterns ### Inline Styles and Custom CSS ```html
``` ### Hardcoded Colors ```json // WRONG: hardcoded hex when a preset exists {"style":{"color":{"background":"#000000","text":"#ffffff"}}} // CORRECT: use theme presets for theme compatibility {"backgroundColor":"contrast","textColor":"base"} ``` Use hardcoded values only when no suitable `preset` exists and the design requires a specific color. ### Missing Escaping and i18n ```php // WRONG: raw text, not translatable, not escaped

Our Services

// WRONG: translatable but not escaped

// CORRECT: escaped and translatable

``` ### Query-Dependent PHP ```php // WRONG: runs at registration time, not render time 3 ) ); ?> // CORRECT: use Query Loop block for dynamic content ``` ### Unclosed or Mismatched Blocks ```html

Title

``` ### Placeholder Image URLs ```html <?php esc_attr_e( 'Featured image', 'theme-slug' ); ?> ``` ## Accessibility Failures ### Missing Alt Text ```html
``` Decorative images (backgrounds, dividers) can use empty alt, but informational images must describe content. ### Skipped Heading Levels ```html Section Title Subsection Section Title Subsection ``` Patterns should use `h2` as the top level (h1 is the page title). Descend sequentially: h2 → h3 → h4. ### Insufficient Color Contrast When using dark backgrounds, verify text presets provide adequate contrast: - `{"backgroundColor":"contrast","textColor":"base"}` — typically safe (dark bg, light text) - Custom color combinations must meet WCAG 2.1 AA (4.5:1 for body text, 3:1 for large text) ### Non-Descriptive Button Text ```html Click Here Read More ``` ### Missing ARIA on Decorative Elements Spacer blocks should include `aria-hidden="true"` (WordPress adds this automatically). If generating custom separator patterns, ensure decorative elements don't announce to screen readers. ## Technical Validation Checklist - [ ] Every `` has matching `` - [ ] JSON in block comments is valid (no trailing commas, strings double-quoted) - [ ] All user-visible strings use `esc_html_e()` or `esc_html__()` - [ ] All URLs use `esc_url()` - [ ] All attribute values with translatable text use `esc_attr_e()` or `esc_attr__()` - [ ] Informational images have descriptive translated alt text; decorative images use empty alt text intentionally - [ ] Heading levels are sequential (h2 → h3 → h4, never skip) - [ ] Preset slugs are valid defaults or documented as theme-specific - [ ] `Slug` in header uses correct namespace: `theme-slug/pattern-name` - [ ] No inline `