Toasts and Overlays
Every action deserves an answer the person can see. A toast is a short message that appears and fades by itself: add a show class, then use setTimeout to remove it a couple of seconds later. Keep the timer's id, and clear it before starting a new one, so a second message restarts the countdown instead of vanishing early.
An overlay covers the page to demand attention, such as an alarm going off. Hide it with display: none in CSS and show it by adding a class. Mark it role="dialog" and aria-modal="true" with a heading, close it with a button and with the Escape key, and move focus onto its main button so keyboard users land inside it.
Mark this lesson complete
Signed in, your progress follows you to every device.