Files
jsonPrism/docs
poli0981andClaude Opus 4.7 a6caa88d9c fix(toast): close button now dismisses on click — upgrade sonner v1.7 to v2 (#52)
User report: the toast close button (×) was visible on both desktop and mobile,
but clicking/tapping it didn't dismiss the toast. Reading sonner v1.7.4's
bundled source, the toast root attaches an `onPointerDown` that calls
`r.target.setPointerCapture(r.pointerId)` unconditionally whenever the toast is
dismissible. Combined with React 19's new event delegation (root-attached
listeners instead of document-wide), this pointer capture quirk swallows the
synthetic click event on the close button — so the bundled handler that calls
`dismiss()` never runs. The bug fires on both mouse and touch because the
PointerEvent capture is API-unified.

Upgrade sonner from ^1.7.0 to ^2.0.7. Sonner v2 rewrote the pointer/swipe
handling and ships first-class React 19 support; the close-button click now
fires reliably on both desktop and mobile. The seven `toast.success/warning/
error/info` usage sites and the `<Toaster>` props (`position`, `theme`,
`richColors`, `closeButton`, `toastOptions.classNames`) are API-compatible
between v1 and v2 — typecheck and the 193 unit tests pass without changes.

Bonus: add a `::after` hit-area expansion on `[data-close-button]` (visible
size stays at sonner's 20px default; effective tap target ~36–40px) plus
`touch-action: manipulation` to eliminate the 300ms tap delay on touch
devices. Defensive — sonner v2 already fixes the underlying click issue, but
the larger hit target is a free mobile UX win.

Also adds:
- `docs/tested-viewports.md` — the manual device test matrix the maintainer
  has been verifying against (BlackBerry Z30 / Galaxy S9+ / Pixel 3/4/7 /
  iPhone SE/12/14 Pro/XR/Pro Max / iPad / BlackBerry PlayBook). Documents the
  Nokia Lumia 520 (320x533) as a known limitation below the recommended
  minimum 360x640.
- README EN + VI link to the new doc.
- THIRD-PARTY.md bumps sonner version 1.7 to 2.0.7.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 14:01:10 +07:00
..
2026-05-13 09:43:37 +07:00
2026-05-13 09:43:37 +07:00