feat(frontend): UX review followups — primitives + a11y/UX fixes across 4 passes

New shared primitives:
- Toaster + toast-store, ConfirmSheet, Modal, focusTrap action,
  pullToRefresh action, avatarPalette + initials helper, Skeleton,
  HeartBurst, haptics, export-status store with onClearAuth hook

Critical UX/a11y:
- Replaced window.confirm with branded ConfirmSheet
- Focus management + Escape on every modal (PIN, Lightbox,
  Onboarding, ContextSheet, data-mode sheet, leave-confirm,
  HTML guide, host/admin ban + PIN-display modals)
- Sheet backdrops are real buttons with aria-label
- Silent ApiError catches now surface via global Toaster

Major polish:
- Dark-mode parity on HashtagChips + avatars (shared palette)
- Conditional Export tab in BottomNav (badge dot when ZIP ready)
- Back chevrons on /recover (history-aware) and /export
- Upload composer discard confirmation when content is staged
- Camera segmented Photo/Video shutter
- PIN auto-submit on 4th digit, paste-flash-free (controlled input)
- Welcome-back toast on /feed after PIN recovery

Minor:
- Skeleton states on feed; pull-to-refresh with live drag indicator
- Haptics on like / capture / submit / PIN-copy / onboarding complete
- Comment 500-char counter; quota "Fast voll" / "Limit erreicht" labels
- Onboarding pip ≥24px tap targets; long-press hint step
- overscroll-behavior lock on <html> while feed mounted
- teardownExportStatus wired via onClearAuth (covers 401 + explicit logout)
- ConfirmSheet per-instance titleId; Modal requires titleId or ariaLabel

Tests (7 new Playwright specs):
- 01-auth/pin-auto-submit, 01-auth/back-chevron
- 03-feed/confirm-sheet-delete, 03-feed/toast-on-failure
- 09-mobile/focus-trap, 09-mobile/sheet-escape,
  09-mobile/upload-cancel-confirm

FOLLOWUPS.md captures the deferred AT inert containment work
with acceptance criteria + implementation sketches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-24 22:50:28 +02:00
parent b241ba6415
commit 309c25bc06
36 changed files with 1751 additions and 433 deletions

View File

@@ -0,0 +1,62 @@
/**
* Critical UX fix — delete confirmation is now a branded bottom-sheet, not
* the native window.confirm(). Long-press on an own upload → Löschen
* → ConfirmSheet opens. Cancel keeps the post; Confirm removes it.
*
* The window.confirm path was jarring on mobile and broke the consistent
* bottom-sheet design language; the ConfirmSheet uses the same shell as
* ContextSheet and traps focus while open.
*/
import { test, expect } from '../../fixtures/test';
import { uploadRaw } from '../../helpers/upload-client';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const SAMPLE_JPG = join(process.cwd(), 'fixtures', 'media', 'sample.jpg');
async function seedUpload(token: string): Promise<{ id: string }> {
const res = await uploadRaw(token, readFileSync(SAMPLE_JPG), {
filename: 'cs.jpg',
contentType: 'image/jpeg',
caption: 'Confirm-sheet fixture',
});
if (res.status !== 201) throw new Error(`Upload seed failed (${res.status})`);
return (await res.json()) as { id: string };
}
test.describe('Feed — ConfirmSheet replaces window.confirm for deletion', () => {
test('Cancel keeps the post; Confirm removes it', async ({ page, guest, signIn }) => {
const g = await guest('CSDelete');
await seedUpload(g.jwt);
await signIn(page, g);
await page.goto('/feed');
const card = page.locator('article').filter({ hasText: g.displayName }).first();
await expect(card).toBeVisible({ timeout: 10_000 });
// Open the desktop kebab (long-press is exercised in 09-mobile; we want
// both code paths covered without depending on touch).
await card.getByRole('button', { name: 'Mehr Aktionen' }).click();
// Context sheet appears. The Löschen action is wired to set pendingDeleteId,
// which opens the ConfirmSheet (data-testid="confirm-sheet").
await page.getByRole('button', { name: /löschen/i }).click();
const confirmSheet = page.getByTestId('confirm-sheet');
await expect(confirmSheet).toBeVisible();
await expect(confirmSheet).toContainText(/beitrag löschen/i);
// Cancel — sheet closes, post stays.
await page.getByTestId('confirm-sheet-cancel').click();
await expect(confirmSheet).not.toBeVisible();
await expect(card).toBeVisible();
// Reopen, confirm — post is removed from the DOM.
await card.getByRole('button', { name: 'Mehr Aktionen' }).click();
await page.getByRole('button', { name: /löschen/i }).click();
await expect(page.getByTestId('confirm-sheet')).toBeVisible();
await page.getByTestId('confirm-sheet-confirm').click();
await expect(page.getByTestId('confirm-sheet')).not.toBeVisible();
await expect(card).not.toBeVisible({ timeout: 5_000 });
});
});