From 6fb7e140df0e6e35e963bdeee3be52748f9fa16f Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:07:10 +0100 Subject: [PATCH] workaround for Webkit --- .changeset/tame-roses-occur.md | 5 +++++ src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/tame-roses-occur.md diff --git a/.changeset/tame-roses-occur.md b/.changeset/tame-roses-occur.md new file mode 100644 index 0000000..022511e --- /dev/null +++ b/.changeset/tame-roses-occur.md @@ -0,0 +1,5 @@ +--- +'@vtbag/cam-shaft': patch +--- + +Implements a workaround for a bug in Webkit where user agent animation have wrong names diff --git a/src/index.ts b/src/index.ts index 6dbf09b..abfc928 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,7 +44,10 @@ addEventListener('pagereveal', async (e) => { document.documentElement, `::view-transition-group(${vtn})` ); - const groupAnimationName = groupStyle.animationName; + let groupAnimationName = groupStyle.animationName; + if (groupAnimationName.startsWith('"')) { + groupAnimationName = groupAnimationName.slice(1, -1); + } if (groupAnimationName === `-ua-view-transition-group-anim-${vtn}`) { const ms = (s: string) => { const res = parseFloat(s);