# Shopping Swipe Gestures — Design Spec **Date:** 2026-03-31 **Status:** Approved ## Scope Add swipe gestures to Shopping list items on mobile. Notes and other modules are explicitly out of scope. ## Behaviour | Gesture | Action | Reveal colour | |---------|--------|---------------| | Swipe left (> threshold) | Toggle checked/unchecked | Green (`--color-success`) | | Swipe right (> threshold) | Delete item | Red (`--color-danger`) | - Reveal label for left swipe: "Abhaken" (unchecked) or "Zurück" (already checked) - Reveal label for right swipe: "Löschen" (always) - Threshold, damping, and scroll-lock logic identical to `tasks.js` - On swipe-right delete: optimistic DOM removal → `DELETE /api/v1/shopping/items/:id` → on error restore item and show danger toast - On swipe-left toggle: optimistic DOM update (class toggle) → `PATCH /api/v1/shopping/items/:id` → on error revert and show danger toast ## CSS Changes **`layout.css`** — receives shared swipe infrastructure (moved from `tasks.css`): - `.swipe-row` base styles - `.swipe-reveal` base styles - `.swipe-reveal--done` (green, used by tasks and shopping) **`tasks.css`** — retains only task-specific styles: - `.swipe-row .task-card` - `.swipe-reveal--edit` (blue, tasks only) - `.swipe-row--swiping .task-card` **`shopping.css`** — new shopping-specific styles: - `.swipe-row .shopping-item` - `.swipe-row--swiping .shopping-item` - `.swipe-reveal--delete` (red, `--color-danger`) - `@media (max-width: 1023px) .item-delete { display: none }` — × button hidden on mobile, swipe replaces it ## JavaScript Changes (`shopping.js`) ### `renderItem(item)` → wrapped in swipe-row ```html