fix(toast): remove shake class before hiding to ensure animationend fires
When dismiss() was called on a persistent+shaking toast, the .shake CSS rule (declared after .hiding) overrode toast-out animation. If shake had already finished, no animationend fired and the element was never removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b7d55fed81
commit
2a247dd70b
|
|
@ -42,6 +42,7 @@ export function showToast(title, { message, level = "error", duration = 4000, sh
|
||||||
|
|
||||||
const dismiss = () => {
|
const dismiss = () => {
|
||||||
if (!el.parentNode) return;
|
if (!el.parentNode) return;
|
||||||
|
el.classList.remove("shake");
|
||||||
el.classList.add("hiding");
|
el.classList.add("hiding");
|
||||||
el.addEventListener("animationend", () => el.remove(), { once: true });
|
el.addEventListener("animationend", () => el.remove(), { once: true });
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue