Files
triqura-ecd/docs/swift/keyboard-shortcuts-reference.md
colinislit 33c6698870 feat(swift): Epic 5 Progress - Error Handling & Keyboard Shortcuts (E5.S2-S3)
Epic 5 deels compleet: Error handling en keyboard shortcuts geïmplementeerd.
Voortgang: 62 SP / 72 SP (86%) - Nog 1 story voor MVP compleet!

E5.S2 - Error Handling (2 SP)
- Gecentraliseerde error handler utility (lib/swift/error-handler.ts)
- isOffline(), isNetworkError(), getErrorInfo() functies
- safeFetch() wrapper met 30s timeout en retry logic
- retryFetch() met exponential backoff (max 3 retries)
- User-friendly Nederlandse error messages voor alle HTTP status codes
- OfflineBanner component met online/offline detection
- Alle blocks en CommandInput gebruiken nieuwe error handler
- Context bar margin adjustment voor offline banner
- parseErrorResponse() voor HTML error detection

E5.S3 - Keyboard Shortcuts (2 SP)
- ⌘Enter / Ctrl+Enter quick submit in CommandInput
- ⌘Enter / Ctrl+Enter quick save in DagnotatieBlock
- Visual hints (⌘↵) op submit button in DagnotatieBlock
- Geverifieerd: ⌘K focus, Escape close, 1-3 FallbackPicker
- Cross-platform support (macOS + Windows/Linux)
- preventDefault() voor browser conflict preventie

Components Updated:
- DagnotatieBlock: safeFetch, getErrorInfo, retryFetch, ⌘Enter save
- OverdrachtBlock: safeFetch, retryFetch voor AI generation
- ZoekenBlock: safeFetch, getErrorInfo voor patient search
- CommandInput: safeFetch, getErrorInfo, ⌘Enter submit
- CommandCenter: OfflineBanner integration
- ContextBar: useOffline hook voor margin adjustment

Nieuwe Files:
- lib/swift/error-handler.ts (301 regels) - Error handling utilities
- components/swift/command-center/offline-banner.tsx (72 regels)
- docs/swift/keyboard-shortcuts-reference.md (200+ regels)
- docs/swift/test-plan-e5-s2-error-handling.md (350+ regels)
- docs/swift/test-plan-e5-s3-keyboard-shortcuts.md (350+ regels)
- docs/swift/PROJECT-STATUS-2024-12-27.md (500+ regels) - Status report

Documentatie:
- Bouwplan bijgewerkt naar v2.5
- Epic completion details toegevoegd met progress bars
- Manual test checklist bijgewerkt (17/20 scenarios)
- Risico's sectie bijgewerkt (alle major risks gemitigeerd)
- Sprint planning status: E5 75% compleet (6/8 SP)

Technische verbeteringen:
- Offline detection met visual feedback
- Network error retry met exponential backoff
- HTTP 401/404/500/503 error messages in Nederlands
- Timeout protection (30s) op alle API calls
- Keyboard shortcuts met visual hints
- Cross-platform shortcut support

Testing:
- Error handling test plan met 8 categorieën
- Keyboard shortcuts test plan met 6 categorieën
- 40+ test scenarios gedocumenteerd
- Quick smoke test checklists

Voortgang: 62 SP / 72 SP (86%) - E5.S2 en E5.S3 compleet

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:27:32 +01:00

5.4 KiB

Swift Keyboard Shortcuts Reference

Versie: 1.0 Datum: 27-12-2024 Status: E5.S3 - Keyboard Shortcuts Verificatie


🎹 Global Shortcuts (altijd actief)

Shortcut Actie Context Status
⌘K / Ctrl+K Focus command input Overal Werkt
Escape Sluit actief block Als block open is Werkt
⌘Enter / Ctrl+Enter Quick submit command Als input focus heeft Toe te voegen

📝 Command Input Shortcuts

Shortcut Actie Context Status
Enter Verstuur commando In command input Werkt (native form)
⌘Enter / Ctrl+Enter Verstuur commando In command input Toe te voegen
Escape Clear input In command input (optioneel) Niet geïmplementeerd

🔍 FallbackPicker Shortcuts

Shortcut Actie Context Status
1 Selecteer Dagnotitie FallbackPicker open Werkt
2 Selecteer Zoeken FallbackPicker open Werkt
3 Selecteer Overdracht FallbackPicker open Werkt
Escape Sluit FallbackPicker FallbackPicker open Werkt

📋 Block-Specific Shortcuts

DagnotatieBlock

Shortcut Actie Context Status
⌘Enter / Ctrl+Enter Opslaan dagnotitie In dagnotitie block Toe te voegen
Escape Sluit block In dagnotitie block Werkt (global)

ZoekenBlock

Shortcut Actie Context Status
Enter Selecteer eerste resultaat In zoek input Optioneel
↓ / ↑ Navigeer door resultaten In zoek input Optioneel
Escape Sluit block In zoeken block Werkt (global)

OverdrachtBlock

Shortcut Actie Context Status
Escape Sluit block In overdracht block Werkt (global)

🎯 MVP Scope (E5.S3)

Voor de MVP implementeren we:

Already Working

  1. ⌘K / Ctrl+K - Focus input
  2. Escape - Close block
  3. Enter - Submit form (native)
  4. 1-3 - FallbackPicker quick select

To Add

  1. ⌘Enter / Ctrl+Enter in CommandInput - Quick submit
  2. ⌘Enter / Ctrl+Enter in DagnotatieBlock - Quick save

Out of Scope (Future)

  1. Arrow key navigation in search results
  2. Escape to clear input
  3. Tab for autocomplete
  4. Vim-style navigation (j/k)

🧪 Test Checklist

Global Shortcuts

  • ⌘K: Press ⌘K → Input krijgt focus
  • ⌘K: Press ⌘K from within block → Input krijgt focus
  • Escape: Open block → Press Escape → Block sluit
  • Escape: FallbackPicker open → Press Escape → Picker sluit

Command Input

  • Enter: Typ commando → Press Enter → Commando wordt verstuurd
  • Enter: Leeg input → Press Enter → Niks gebeurt (validation)
  • ⌘Enter: Typ commando → Press ⌘Enter → Commando wordt verstuurd
  • ⌘Enter: Focus niet in input → Press ⌘Enter → Niks gebeurt

FallbackPicker

  • 1: FallbackPicker open → Press 1 → Dagnotitie opent
  • 2: FallbackPicker open → Press 2 → Zoeken opent
  • 3: FallbackPicker open → Press 3 → Overdracht opent
  • Numbers: In input field → Press 1-3 → Nummer wordt getypt (niet shortcut)

DagnotatieBlock

  • ⌘Enter: Vul form in → Press ⌘Enter → Dagnotitie wordt opgeslagen
  • ⌘Enter: Form incomplete → Press ⌘Enter → Validation error
  • Escape: DagnotatieBlock open → Press Escape → Block sluit

Edge Cases

  • Multiple shortcuts in rapid succession (⌘K → Escape → Enter)
  • Shortcuts werken niet tijdens isProcessing state
  • Shortcuts werken op macOS (⌘) en Windows/Linux (Ctrl)
  • Shortcuts conflicteren niet met browser defaults

📝 Implementation Notes

Cmd vs Ctrl Detection

// Use both metaKey (Cmd on Mac) and ctrlKey (Ctrl on Windows/Linux)
if (e.metaKey || e.ctrlKey) {
  // Handle shortcut
}

Preventing Default Behavior

// Always preventDefault for custom shortcuts
if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
  e.preventDefault(); // Prevent browser's native ⌘K
  inputRef.current?.focus();
}

Conditional Shortcuts

// Only handle when not in input/textarea
if (e.target instanceof HTMLInputElement ||
    e.target instanceof HTMLTextAreaElement) {
  return; // Let native behavior handle it
}

Accessibility

  • All shortcuts should have visual hints (e.g., "⌘K" label)
  • Shortcuts should work with screen readers
  • Focus management must be clear (visible focus ring)

🔧 Future Enhancements

Phase 2

  • Cmd+Shift+K - Toggle voice input
  • Cmd+/ - Show keyboard shortcuts help
  • Cmd+P - Quick patient search
  • Cmd+N - New dagnotitie
  • Cmd+O - Open overdracht

Phase 3

  • Customizable shortcuts (user preferences)
  • Vim-style modal editing
  • Search results navigation (arrow keys)
  • Multi-block shortcuts (Cmd+1, Cmd+2, etc.)

📚 Resources