mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
Make viewTransition.finished wait for animations triggered by viewTransition.ready (#10787)
This commit is contained in:
parent
1607face67
commit
699f4559a2
2 changed files with 8 additions and 1 deletions
5
.changeset/stupid-countries-warn.md
Normal file
5
.changeset/stupid-countries-warn.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"astro": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes a timing issue in the view transition simulation.
|
|
@ -396,8 +396,10 @@ async function updateDOM(
|
||||||
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
|
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
|
||||||
return style.animationIterationCount === 'infinite';
|
return style.animationIterationCount === 'infinite';
|
||||||
}
|
}
|
||||||
// Trigger the animations
|
|
||||||
const currentAnimations = document.getAnimations();
|
const currentAnimations = document.getAnimations();
|
||||||
|
// allow animations triggered by viewTransition.ready to start
|
||||||
|
await new Promise<void>((r)=>setTimeout(r));
|
||||||
|
// Trigger view transition animations waiting for data-astro-transition-fallback
|
||||||
document.documentElement.setAttribute(OLD_NEW_ATTR, phase);
|
document.documentElement.setAttribute(OLD_NEW_ATTR, phase);
|
||||||
const nextAnimations = document.getAnimations();
|
const nextAnimations = document.getAnimations();
|
||||||
const newAnimations = nextAnimations.filter(
|
const newAnimations = nextAnimations.filter(
|
||||||
|
|
Loading…
Add table
Reference in a new issue