From 788f76601605d17eefdbead04542a008e3905756 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Wed, 2 Oct 2024 16:06:59 +0200 Subject: [PATCH] Fix animation cancellation in token-transitions --- packages/codehike/src/utils/token-transitions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/codehike/src/utils/token-transitions.tsx b/packages/codehike/src/utils/token-transitions.tsx index 2eff3080..77a93653 100644 --- a/packages/codehike/src/utils/token-transitions.tsx +++ b/packages/codehike/src/utils/token-transitions.tsx @@ -241,6 +241,7 @@ function toSnapshotElement(el: HTMLElement): SnapshotElement { y += p.offsetTop p = p.offsetParent } + el?.getAnimations().forEach((a) => a.cancel()) const style = window.getComputedStyle(el) const color = style.color const content = el.textContent