Skip to content

Commit

Permalink
workaround for Webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Jan 2, 2025
1 parent 47993dd commit 6fb7e14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tame-roses-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vtbag/cam-shaft': patch
---

Implements a workaround for a bug in Webkit where user agent animation have wrong names
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6fb7e14

Please sign in to comment.