@@ -1550,16 +1550,16 @@ export function hasInstanceAffectedParent(
1550
1550
return oldRect . height !== newRect . height || oldRect . width !== newRect . width ;
1551
1551
}
1552
1552
1553
- function cancelAllViewTransitionAnimations ( ownerDocument : Document ) {
1553
+ function cancelAllViewTransitionAnimations ( scope : Element ) {
1554
1554
// In Safari, we need to manually cancel all manually start animations
1555
1555
// or it'll block or interfer with future transitions.
1556
- const animations = ownerDocument . getAnimations ( ) ;
1556
+ const animations = scope . getAnimations ( { subtree : true } ) ;
1557
1557
for ( let i = 0 ; i < animations . length ; i ++ ) {
1558
1558
const anim = animations [ i ] ;
1559
1559
const effect : KeyframeEffect = ( anim . effect : any ) ;
1560
1560
// $FlowFixMe
1561
1561
const pseudo : ?string = effect . pseudoElement ;
1562
- if ( pseudo != null && pseudo . startsWith ( '::view-transition' ) ) {
1562
+ if ( pseudo != null && pseudo . startsWith ( '::view-transition' ) && effect . target === scope ) {
1563
1563
anim . cancel ( ) ;
1564
1564
}
1565
1565
}
@@ -1655,7 +1655,7 @@ export function startViewTransition(
1655
1655
}
1656
1656
transition . ready . then ( spawnedWorkCallback , spawnedWorkCallback ) ;
1657
1657
transition . finished . then ( ( ) => {
1658
- cancelAllViewTransitionAnimations ( ownerDocument ) ;
1658
+ cancelAllViewTransitionAnimations ( ( ownerDocument . documentElement : any ) ) ;
1659
1659
// $FlowFixMe[prop-missing]
1660
1660
if ( ownerDocument . __reactViewTransition === transition ) {
1661
1661
// $FlowFixMe[prop-missing]
@@ -1932,7 +1932,7 @@ export function startGestureTransition(
1932
1932
: readyCallback ;
1933
1933
transition . ready . then ( readyForAnimations , readyCallback ) ;
1934
1934
transition . finished . then ( ( ) => {
1935
- cancelAllViewTransitionAnimations ( ownerDocument ) ;
1935
+ cancelAllViewTransitionAnimations ( ( ownerDocument . documentElement : any ) ) ;
1936
1936
// $FlowFixMe[prop-missing]
1937
1937
if ( ownerDocument . __reactViewTransition === transition ) {
1938
1938
// $FlowFixMe[prop-missing]
0 commit comments