All Challenges

Toast Notification Stack (Auto-Dismiss + Pause on Hover)

JavaScriptMediumAtlassianVercelRazorpay
30:00

Problem Brief

Build a stacked toast notification manager supporting success/error triggers, auto-dismiss timers, hover-pause, and manual close.

Requirements

  • Clicking `[data-testid="add-toast"]` creates a `.toast-item` inside `[data-testid="toast-stack"]`.
  • Each toast auto-dismisses after the configurable delay (default `250ms` in test mode or `3000ms` default).
  • Hovering a toast (`mouseenter`) pauses its timer; `mouseleave` resumes removal.
  • Clicking the toast close button `[data-close]` removes it immediately.
Progressive Hints (2)
  • Store remaining time (`remainingMs`) and start timestamp per toast so hover pause/resume is exact.
  • Remove the DOM node cleanly inside both manual close and timeout callback.
Reference Solution

Stuck? Load the verified reference code into your editor.

Automated Test Suite

3 Test Cases Ready
  • Appends stacked toasts and dismisses manuallyClicking add-toast renders .toast-item and close removes it
  • Auto-dismisses after configured delayToast disappears automatically after delay ms
  • Pauses timer on hover and resumes on leavemouseenter keeps toast alive past timeout until mouseleave
solution.html
Live Sandboxed Previewiframe sandbox
Starter template loaded — add your <script> logic in the editor (or open Reference Solution) to make the widget interactive.