Skip to content

v0.2.1 — Robust toast dismissal

Latest

Choose a tag to compare

@marilenaRM marilenaRM released this 13 Jul 16:26
c113e20

Fixed

  • Dismissed toasts could stay in the DOM forever when the consumer app does not load the optional toast.css (or overrides .toast without a transition): transitionend never fires, so the removal never ran. dismiss() now reads the effective transition duration via getComputedStyle and removes the element immediately when it is zero, otherwise keeps the transitionend listener with a setTimeout fallback slightly above the duration. This also covers prefers-reduced-motion and interrupted transitions.
  • transitionend bubbling from descendants (custom <template> toasts containing e.g. a progress bar or a button with its own transition) could tear the toast down early. The handler now reacts only to the toast's own transition (event.target === element).
  • Asymmetric teardown: the transitionend listener is now removed in disconnect() too, not just the fallback timer.

Changed

  • Controller test suite converted to fake timers — deterministic and ~7× faster — with a new regression test for the descendant-bubbling guard.

Full changelog: v0.2.0...v0.2.1