# Accessibility Test Matrix — Layer-Aware Coverage

**Purpose:** Define WCAG 2.1 AA baseline with **manual-testable vs deferred** separation to eliminate accessibility leakage in TestChecklist generation.

**Used by:** `/tas-TestChecklist` Phase 1.5.3B (NFR population) + Phase 2.1 (Accessibility TP generation)

**Key Change:** "Deferred" ≠ "Out-of-Scope" — deferred accessibility still generates TPs with `Status: Deferred` tag.

---

## Layer 1: Manual-Testable Accessibility (PE Scope)

> **Rule:** If accessibility check can be performed via keyboard, screen reader, or visual inspection → PE generates TP in TestChecklist.
> **Rationale:** Basic accessibility (keyboard nav, focus visible, screen reader basics) is PE's responsibility, even if full WCAG certification is deferred.

| # | Category | Test Point | WCAG Standard | Manual Test Approach | Expected Outcome | Tool |
|---|----------|-----------|---------------|---------------------|------------------|------|
| 1 | **Keyboard Navigation** | Tab Order | 2.1.1 | Tab through photo upload area → verify focus visible | Focus indicator visible + logical tab order | Manual |
| 2 | **Keyboard Navigation** | Keyboard Accessible | 2.1.1 | Tab through questionnaire Card 1-3 → verify all radio/checkbox keyboard-accessible | All interactive elements operable via keyboard | Manual |
| 3 | **Keyboard Navigation** | Focus Visible | 2.4.7 | Tab to each button/link → verify focus indicator visible | Clear focus ring (2px contrast ≥3:1) | Manual |
| 4 | **Keyboard Navigation** | Skip Link | 2.4.1 | Press Tab on page load → verify skip link appears | Skip link visible on first tab | Manual |
| 5 | **Screen Reader** | Photo Upload Announced | 1.3.1 | Upload photo → verify screen reader announces "Upload photos, 1 of 5 steps" | Correct label + role announced | NVDA/VoiceOver |
| 6 | **Screen Reader** | Questionnaire Cards Announced | 1.3.1 | Navigate questionnaire → verify cards announced with labels + roles | Each card has role="group" + aria-label | NVDA/VoiceOver |
| 7 | **Screen Reader** | Error Messages Announced | 3.3.1 | Trigger validation error → verify screen reader announces error | Error announced with role="alert" | NVDA/VoiceOver |
| 8 | **Color Contrast** | Error Messages | 1.4.3 | Check error message text against background | Contrast ratio ≥4.5:1 | Contrast Checker |
| 9 | **Color Contrast** | Body Text | 1.4.3 | Check body text against background | Contrast ratio ≥4.5:1 | Contrast Checker |
| 10 | **ARIA Attributes** | Progress Indicator | 1.3.6 | Check progress indicator HTML | Has role="progressbar" + aria-valuenow | Manual inspection |
| 11 | **ARIA Attributes** | Form Fields | 1.3.1 | Check questionnaire field HTML | Has label + aria-required (if required) | Manual inspection |
| 12 | **ARIA Attributes** | Error Summary | 3.3.1 | Check error summary HTML | Has role="alert" + aria-live="polite" | Manual inspection |

**TP Generation Rule:** For Platform = Web → auto-generate Priority 2 accessibility TPs (F003-A11Y-001 through F003-A11Y-012) in TestChecklist §2.1.

---

## Layer 2: Deferred Accessibility (Future Phase)

> **Rule:** If accessibility check requires specialized audit or full WCAG certification → tag as `Status: Deferred` in TestChecklist TP metadata.
> **Rationale:** Full certification is costly/time-consuming; basic checks still done in current phase.

| # | Category | Test Point | WCAG Standard | Deferred Reason | Future Phase |
|---|----------|-----------|---------------|-----------------|--------------|
| 1 | **Automated Scan** | Axe DevTools Full Audit | WCAG 2.1 AA | Requires Axe DevTools + remediation time | Phase 3 |
| 2 | **Screen Reader Matrix** | NVDA + JAWS + VoiceOver | 1.3.1 | Multiple screen readers + training overhead | Phase 3 |
| 3 | **Color Blindness** | Simulated color blind views | 1.4.1 | Requires color blindness simulation tools | Phase 3 |
| 4 | **Resize Text** | 200% text zoom | 1.4.4 | Requires browser zoom testing across all pages | Phase 3 |
| 5 | **Touch Target Size** | 44×44px minimum | 2.5.5 | Requires design review + UI adjustment | Phase 3 |

**TestChecklist TP Entry Example:**
```
TP ID:       F003-A11Y-001
Category:    Accessibility
Test Point:  Tab through photo upload area → verify focus visible
Priority:    P2
Source:      WCAG 2.1 AA 2.1.1
Status:      Deferred
Reason:      Basic check included; full WCAG certification → Phase 3
```

---

## Platform-Specific Baselines

### Web (PC + Tablet + Mobile)

| Viewport | Test Points | Auto-Generated? |
|----------|-------------|------------------|
| **Mobile 375px** | Keyboard navigation, touch targets ≥44×44px, focus visible | ✅ YES |
| **Tablet 768px** | Keyboard navigation, focus visible, progress indicator | ✅ YES |
| **Desktop 1024px+** | Keyboard navigation, skip link, ARIA attributes | ✅ YES |

### App (iOS + Android)

| Platform | Test Points | Auto-Generated? |
|----------|-------------|------------------|
| **iOS** | VoiceOver navigation, Dynamic Type (200% text), touch targets | ✅ YES (if Platform = App) |
| **Android** | TalkBack navigation, font size 200%, touch targets | ✅ YES (if Platform = App) |

---

## Priority Mapping for Accessibility TP Generation

**Priority 1 (Always Cover — P0):**
- Keyboard Navigation (tab order, focus visible, keyboard accessible)
- ARIA Attributes (progress indicator, form fields, error summary)

**Priority 2 (Cover if Applicable — P1/P2):**
- Screen Reader (photo upload announced, questionnaire cards announced, error messages announced)
- Color Contrast (error messages, body text)

**Priority 3 (Cover if Documented — P2):**
- Skip Link
- Touch Target Size (if Platform = App or Mobile Web)

**Rule for TestChecklist Generation:**
- If Platform = Web → auto-generate Priority 1 + 2 accessibility TPs (keyboard + ARIA + screen reader + color contrast)
- If Platform = App → auto-generate Priority 1 + 2 + 3 (add touch targets + dynamic type/font size)
- If Feature.md marks accessibility as "Deferred" → tag all accessibility TPs with `Status: Deferred`

---

## Gap Prevention Rules for TestChecklist

### Rule 1: Deferred ≠ Out-of-Scope

**Problem:** Accessibility marked as "Deferred" in Feature.md → removed from TestChecklist entirely.

**Fix:** Add `Status` column to TestChecklist §2.1 TP metadata:
```markdown
| TP ID | Test Point | Prio | Source | Status |
|-------|-----------|------|--------|--------|
| F003-A11Y-001 | Tab through photo upload → verify focus visible | P2 | WCAG 2.1 AA 2.1.1 | Deferred |
```

**Rule:** TPs with `Status: Deferred` still appear in TestChecklist but marked for future phase.

### Rule 2: Platform NFR Baseline Must Be Read

**Problem:** Phase 1.5.4 confirms "Platform = Web" but does NOT read accessibility baseline → missing accessibility TPs.

**Fix:** Update `/tas-TestChecklist` Phase 1.5.4 logic:
1. Confirm platform (web|app|all)
2. **Immediately READ** `test-design.md` § Platform NFR Baselines
3. For Platform = Web → auto-populate §2.2 with accessibility baseline (WCAG 2.1 AA)
4. For Platform = App → auto-populate with accessibility baseline (VoiceOver/TalkBack)
5. Generate accessibility TPs per Priority Mapping table above
6. If Feature.md marks accessibility as "Deferred" → tag TPs with `Status: Deferred`

### Rule 3: Accessibility is PE-Testable

**Problem:** Accessibility incorrectly classified as "Tool-Based / DSE" → manual keyboard/screen reader checks missing.

**Fix:** Update TestChecklist §1.2 (Out-of-Scope) with clear split:
```markdown
| Item | Category | Owner | Note |
|------|----------|-------|------|
| Basic accessibility (keyboard nav, screen reader, color contrast) | Accessibility | PE | Manual checks → IN TestChecklist |
| Full WCAG certification (Axe audit, multiple screen readers) | Accessibility | Product | Deferred → Phase 3 |
```

---

## Integration with TestChecklist Generation

### Phase 1.5.3B: NFR Population (Updated)

**Current Logic:**
```
Read test-design.md → Platform NFR Baselines → Populate §2.2
```

**Updated Logic:**
```
1. Read test-design.md → Platform NFR Baselines → Populate §2.2
2. READ accessibility-test-matrix.md (this file)
3. For Platform = Web → auto-generate Priority 1 + 2 accessibility TPs (keyboard + ARIA + screen reader + color contrast)
4. For Platform = App → auto-generate Priority 1 + 2 + 3 (add touch targets + dynamic type)
5. IF Feature.md marks accessibility as "Deferred" → tag all accessibility TPs with Status: Deferred
6. VERIFY §1.2 (Out-of-Scope) does NOT classify basic accessibility as "Tool-Based / DSE"
```

### Phase 1.5.2.5: Gap Detection (Updated)

**Current Logic:**
```
Scan AC text → 12 gap patterns → Ask questions
```

**Updated Logic:**
```
1. Scan AC text → 12 gap patterns → Ask questions
2. SCAN Feature.md for "Accessibility" or "WCAG" mentions
3. IF "Deferred" found → still generate accessibility TPs but tag with Status: Deferred
4. VERIFY accessibility baseline read from test-design.md
5. IF Platform = Web AND accessibility not mentioned → ask user: "Include basic accessibility checks (keyboard nav, screen reader)?"
```

---

## Example: Feature-003 Corrected Accessibility Coverage

### Current Coverage (Gaps Identified):
- **Missing:** All accessibility TPs (marked as "Deferred" → removed entirely)

### Corrected Coverage (After Applying This Matrix):
- **F003-A11Y-001** (Tab through photo upload → verify focus visible) ✅ [Status: Deferred]
- **F003-A11Y-002** (Tab through questionnaire Card 1-3 → verify keyboard-accessible) ✅ [Status: Deferred]
- **F003-A11Y-003** (Upload photo → verify screen reader announces "Upload photos, 1 of 5 steps") ✅ [Status: Deferred]
- **F003-A11Y-004** (Questionnaire cards announced with correct labels + roles) ✅ [Status: Deferred]
- **F003-A11Y-005** (Error messages have ≥4.5:1 contrast ratio against background) ✅ [Status: Deferred]
- **F003-A11Y-006** (Progress indicator has role="progressbar" + aria-valuenow) ✅ [Status: Deferred]

**Result:** 6 accessibility TPs added (all manual-testable via keyboard/screen reader), eliminating Category 2 leakage.

**Deferred Status:** All 6 TPs tagged with `Status: Deferred` → acknowledged in TestChecklist but deferred to Phase 3, preventing total removal.

---

## Metadata for TP Generation

**TP ID Convention:** `{FEATURE}-A11Y-{NNN}` for Layer 1 accessibility TPs
**Priority Mapping:** Priority 1 → P0, Priority 2 → P1, Priority 3 → P2
**Test Approach:** "Keyboard Navigation" (Layer 1) or "Screen Reader" (Layer 1) or "Visual Inspection" (Layer 1)
**Source Reference:** accessibility-test-matrix.md Layer 1 table row # + WCAG criterion
**Dedup Rule:** If same accessibility check applies to multiple screens (e.g., focus visible) → 1 TP shared across flows

---

## Phase 3 Full Certification Checklist (Future Reference)

When Feature.md marks accessibility as "In-Scope" (not deferred), run this checklist:

| # | Check | Tool | Expected |
|---|-------|------|----------|
| 1 | Axe DevTools scan (all pages) | Axe | 0 violations (auto-fixable OK) |
| 2 | NVDA navigation (all flows) | NVDA | Logical tab order + announcements |
| 3 | VoiceOver navigation (iOS) | VoiceOver | Logical swipe order + announcements |
| 4 | TalkBack navigation (Android) | TalkBack | Logical swipe order + announcements |
| 5 | Color contrast checker (all text) | Contrast Checker | ≥4.5:1 for normal text, ≥3:1 for large |
| 6 | 200% text zoom (all pages) | Browser zoom | No horizontal scroll, content readable |
| 7 | Touch targets (mobile/app) | Ruler | All buttons ≥44×44px |
| 8 | Color blindness simulation | Toptal Color Blind Simulator | Content distinguishable for all types |

**Current Scope:** Layer 1 only (manual keyboard + screen reader basics). Layer 2 (full certification) → Phase 3.