wealth/docs/decisions/0019-every-toast-closes-by-...

1.1 KiB

0019 Every toast closes by itself

Status: Accepted · Area: design · Date: 2026-10-06 · Decided by: user

Context

Action-error toasts stayed until dismissed (duration: Infinity), so one could follow the person to the next pages and never leave. The user asked for every toast to disappear after a delay.

Decision

  • Every toast closes on its own: success and info after 4 seconds (6 with an action), errors after 8 seconds (10 with their «تلاش دوباره» or reload button).
  • Island's showToast sets these defaults by tone; callers pass duration only for a reason they can name, never Infinity.
  • Hovering or focusing a toast, or leaving the tab, pauses its clock. Island's Toast runs that clock, because sonner 2 doesn't pause on focus; sonner only places the toast.

Alternatives

  • Errors stay until dismissed: the skill's default; replaced at the user's request.

Consequences

  • What an error asks the person to do must also show on the page (a field error, the form alert or the state), not only in the toast, as the form rules already require.