Commit 74869753ea2 for woocommerce

commit 74869753ea21e4b0b800523de99ece5e4ee565d8
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu Nov 26 12:58:26 2026 +0000

    Add motion to list entrances (#70926)

    * Add motion to list entrances

    Cart items and Checkout summary items rise in 50ms apart the first time
    they show, and the order confirmation sections when the page loads.
    The empty cart rises in when the last item goes.

    * Keep the quantity badge positioned with transform

    The badge moved from transform to the translate property so it would grow in about its own centre. A theme that overrides the badge's transform then got both offsets. Keep trunk's transform positioning and set transform-origin to the badge's translated centre, which RTL styles flip with the transform.

    * Remove the list entrance attribute when its wait is cancelled

    Cancelling the wait on unmount left data-wc-list-entering on the list. When StrictMode replays effects, the second start returned early because the list had already entered, so the attribute stayed after the motion ended. The cleanup now removes the attribute and lets a remount start again.

    * Keep the removal's input when the shopper clicks during it

    The empty cart checked the last click on the page. A click elsewhere while a keyboard removal of the last item was still in flight made the empty cart rise in. Stop listening while item changes are pending, so the click that started the removal decides.

    * Read the removal's input when the removal starts

    The empty cart stopped tracking clicks while any item operation was pending, including a quantity update. Enter on Remove during a pointer quantity update then left the last click as the input, and the empty cart rose in. Read isKeyboardInput() when a removal starts instead, so only the removal's own input decides.

    * Play the empty cart entrance only after a pointer removal

    The entrance also played when a cart update emptied the cart without a removal, because the guard only checked that the cart had items before. It now needs a pointer removal that is still pending when the cart empties.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    ---------

    Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/plugins/woocommerce/changelog/add-cart-checkout-motion-list-entrances b/plugins/woocommerce/changelog/add-cart-checkout-motion-list-entrances
new file mode 100644
index 00000000000..d2c0ce75233
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-cart-checkout-motion-list-entrances
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Cart items, Checkout order summary items and order confirmation details now rise in as they first load, and the empty cart rises in when the last item is removed.
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/index.tsx
index 83956bc0c0b..6380725de71 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/index.tsx
@@ -8,6 +8,7 @@ import { createRef, useEffect, useRef } from '@wordpress/element';
 import type { RefObject } from 'react';
 import { CartLineItemsCartSkeleton } from '@woocommerce/base-components/skeleton/patterns/cart-line-items';
 import { DelayedContentWithSkeleton } from '@woocommerce/base-components/delayed-content-with-skeleton';
+import { useListEntrance } from '@woocommerce/base-hooks';

 /**
  * Internal dependencies
@@ -36,6 +37,8 @@ const CartLineItemsTable = ( {
 	className,
 }: CartLineItemsTableProps ): JSX.Element => {
 	const tableRef = useRef< HTMLTableElement | null >( null );
+	const bodyRef = useRef< HTMLTableSectionElement | null >( null );
+	const onRowsShow = useListEntrance( bodyRef );
 	const rowRefs = useRef( setRefs( lineItems ) );
 	const onClickCapture = useRowRemovalMotion(
 		tableRef,
@@ -65,6 +68,7 @@ const CartLineItemsTable = ( {
 		<DelayedContentWithSkeleton
 			isLoading={ isLoading }
 			skeleton={ <CartLineItemsCartSkeleton /> }
+			onShow={ onRowsShow }
 		>
 			<>
 				{ lineItems.map( ( lineItem, i ) => {
@@ -122,7 +126,7 @@ const CartLineItemsTable = ( {
 					</th>
 				</tr>
 			</thead>
-			<tbody>{ products }</tbody>
+			<tbody ref={ bodyRef }>{ products }</tbody>
 		</table>
 	);
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/style.scss b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/style.scss
index 2bfc1b0d722..fa8a87b6815 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/cart-line-items-table/style.scss
@@ -281,3 +281,13 @@ table.wc-block-cart-items {
 		}
 	}
 }
+
+// Rows rise in, 50ms apart, the first time they show (`useListEntrance`). The cells animate, not the row, so the
+// movement works in table and grid layouts and does not override the row's dimmed opacity.
+.wp-block-woocommerce-cart [data-wc-list-entering] > .wc-block-cart-items__row {
+	@include motion-stagger-index;
+
+	> td {
+		@include motion-enter($delay: motion-stagger-delay());
+	}
+}
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/index.tsx
index 9018d553a92..75d8fdc0553 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/index.tsx
@@ -7,6 +7,8 @@ import {
 } from '@woocommerce/base-context';
 import type { CartItem } from '@woocommerce/types';
 import clsx from 'clsx';
+import { useRef } from '@wordpress/element';
+import { useListEntrance } from '@woocommerce/base-hooks';
 import { CartLineItemsCheckoutSkeleton } from '@woocommerce/base-components/skeleton/patterns/cart-line-items';
 import { DelayedContentWithSkeleton } from '@woocommerce/base-components/delayed-content-with-skeleton';
 /**
@@ -27,6 +29,8 @@ const OrderSummary = ( {
 	const { isLarge } = useContainerWidthContext();
 	const { cartIsLoading, hasPendingItemsOperations } = useStoreCart();
 	const showSkeleton = cartIsLoading || hasPendingItemsOperations;
+	const contentRef = useRef< HTMLDivElement | null >( null );
+	const onItemsShow = useListEntrance( contentRef );

 	return (
 		<DelayedContentWithSkeleton
@@ -36,13 +40,17 @@ const OrderSummary = ( {
 					rows={ cartItems?.length || 2 }
 				/>
 			}
+			onShow={ onItemsShow }
 		>
 			<div
 				className={ clsx( 'wc-block-components-order-summary', {
 					'is-large': isLarge,
 				} ) }
 			>
-				<div className="wc-block-components-order-summary__content">
+				<div
+					className="wc-block-components-order-summary__content"
+					ref={ contentRef }
+				>
 					{ cartItems.map( ( cartItem ) => {
 						return (
 							<OrderSummaryItem
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/style.scss b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/style.scss
index b3de0f5c89d..186d2635650 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/order-summary/style.scss
@@ -78,6 +78,8 @@
 		right: 0;
 		top: 0;
 		transform: translate(50%, -50%);
+		// The badge's centre after the translate above, so it grows in about its own centre.
+		transform-origin: top right;
 		white-space: nowrap;
 		z-index: 1;

@@ -140,3 +142,13 @@
 		padding-top: $gap-smallest;
 	}
 }
+
+// Items rise in, 50ms apart, the first time they show (`useListEntrance`). Each quantity badge grows in one step
+// after its item.
+.wp-block-woocommerce-checkout [data-wc-list-entering] > .wc-block-components-order-summary-item {
+	@include motion-stagger;
+
+	.wc-block-components-order-summary-item__quantity {
+		@include motion-enter(wc-grow, $delay: motion-stagger-delay(1));
+	}
+}
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
index 9e7d03f17d9..4654dc4648e 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
@@ -1,7 +1,7 @@
 /**
  * External dependencies
  */
-import { useState, useEffect } from '@wordpress/element';
+import { useState, useEffect, useLayoutEffect } from '@wordpress/element';
 import { useReducedMotion } from '@wordpress/compose';
 import type { ReactNode } from 'react';

@@ -20,6 +20,11 @@ export interface DelayedContentWithSkeletonProps {
 	 * The skeleton component to show while loading
 	 */
 	skeleton: ReactNode;
+
+	/**
+	 * Runs after the content shows, in place of the skeleton or on mount
+	 */
+	onShow?: () => void;
 }

 /**
@@ -73,8 +78,17 @@ export const DelayedContentWithSkeleton = ( {
 	children,
 	isLoading,
 	skeleton,
+	onShow,
 }: DelayedContentWithSkeletonProps ): JSX.Element => {
 	const showSkeleton = useDelayedSkeleton( isLoading );

+	useLayoutEffect( () => {
+		if ( ! showSkeleton ) {
+			onShow?.();
+		}
+		// Only when the skeleton ends, not when the callback changes.
+		// eslint-disable-next-line react-hooks/exhaustive-deps
+	}, [ showSkeleton ] );
+
 	return <>{ showSkeleton ? skeleton : children }</>;
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/hooks/index.js b/plugins/woocommerce/client/blocks/assets/js/base/hooks/index.js
index c0310e70907..89ab4c3a52d 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/hooks/index.js
+++ b/plugins/woocommerce/client/blocks/assets/js/base/hooks/index.js
@@ -14,3 +14,4 @@ export * from './use-query-loop-product-context-validation';
 export * from './use-preview-mode';
 export * from './use-presence';
 export * from './use-toggle-collapse';
+export * from './use-list-entrance';
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/hooks/test/use-list-entrance.tsx b/plugins/woocommerce/client/blocks/assets/js/base/hooks/test/use-list-entrance.tsx
new file mode 100644
index 00000000000..fce092cf139
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/assets/js/base/hooks/test/use-list-entrance.tsx
@@ -0,0 +1,67 @@
+/**
+ * External dependencies
+ */
+import { act, render } from '@testing-library/react';
+import { StrictMode, useLayoutEffect, useRef } from '@wordpress/element';
+
+/**
+ * Internal dependencies
+ */
+import { useListEntrance } from '../use-list-entrance';
+
+const List = () => {
+	const ref = useRef< HTMLUListElement | null >( null );
+	const start = useListEntrance( ref );
+	useLayoutEffect( () => start(), [ start ] );
+	return <ul ref={ ref } data-testid="list" />;
+};
+
+describe( 'useListEntrance', () => {
+	let finish: () => void;
+
+	beforeEach( () => {
+		// One running animation in the list. Like a browser animation, it reports `finished` once `finish` is called.
+		let resolveFinished = () => undefined as void;
+		const animation = {
+			playState: 'running',
+			finished: new Promise< void >( ( resolve ) => {
+				resolveFinished = resolve;
+			} ),
+			effect: { getComputedTiming: () => ( { endTime: 200 } ) },
+		};
+		finish = () => {
+			animation.playState = 'finished';
+			resolveFinished();
+		};
+		Element.prototype.getAnimations = () => [
+			animation as unknown as Animation,
+		];
+	} );
+
+	afterEach( () => {
+		// @ts-expect-error jsdom has no getAnimations.
+		delete Element.prototype.getAnimations;
+	} );
+
+	it( 'marks the list until its entrances end', async () => {
+		const { getByTestId } = render( <List /> );
+		const list = getByTestId( 'list' );
+
+		expect( list ).toHaveAttribute( 'data-wc-list-entering' );
+		await act( async () => finish() );
+		expect( list ).not.toHaveAttribute( 'data-wc-list-entering' );
+	} );
+
+	it( 'leaves no attribute behind when StrictMode replays its effects', async () => {
+		const { getByTestId } = render(
+			<StrictMode>
+				<List />
+			</StrictMode>
+		);
+		const list = getByTestId( 'list' );
+
+		expect( list ).toHaveAttribute( 'data-wc-list-entering' );
+		await act( async () => finish() );
+		expect( list ).not.toHaveAttribute( 'data-wc-list-entering' );
+	} );
+} );
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/hooks/use-list-entrance.ts b/plugins/woocommerce/client/blocks/assets/js/base/hooks/use-list-entrance.ts
new file mode 100644
index 00000000000..7c45d38efa7
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/assets/js/base/hooks/use-list-entrance.ts
@@ -0,0 +1,61 @@
+/**
+ * External dependencies
+ */
+import {
+	useCallback,
+	useEffect,
+	useLayoutEffect,
+	useRef,
+} from '@wordpress/element';
+import type { RefObject } from 'react';
+import { whenAnimationsEnd } from '@woocommerce/base-utils';
+
+/**
+ * Lets the rows of a list stagger in once, the first time the list shows. Call the returned function when the rows
+ * show, such as from the `onShow` of `DelayedContentWithSkeleton`. It sets `data-wc-list-entering` on the list until
+ * the rows' entrances end, so later rows, updates, and moves do not enter again.
+ *
+ * @param ref The list. Style its rows with `motion-stagger` under `[data-wc-list-entering]`.
+ * @return A function that starts the entrance, one time only.
+ */
+export const useListEntrance = (
+	ref: RefObject< HTMLElement | null >
+): ( () => void ) => {
+	const hasEntered = useRef( false );
+	const isPending = useRef( false );
+	const cancel = useRef< () => void >();
+
+	const start = useCallback( () => {
+		if ( hasEntered.current ) {
+			return;
+		}
+		const list = ref.current;
+		if ( ! list ) {
+			isPending.current = true;
+			return;
+		}
+		hasEntered.current = true;
+		list.setAttribute( 'data-wc-list-entering', '' );
+		const end = () => list.removeAttribute( 'data-wc-list-entering' );
+		const stopWaiting = whenAnimationsEnd( list, end, { subtree: true } );
+		// An unmount, or a StrictMode effect replay, stops the wait. Remove the attribute too, so it is not left
+		// behind, and let a remount start again.
+		cancel.current = () => {
+			stopWaiting();
+			end();
+			hasEntered.current = false;
+		};
+	}, [ ref ] );
+
+	// On mount, a child can call `start` before React attaches the ref of a list that wraps it.
+	useLayoutEffect( () => {
+		if ( isPending.current ) {
+			isPending.current = false;
+			start();
+		}
+	} );
+
+	useEffect( () => () => cancel.current?.(), [] );
+
+	return start;
+};
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/utils/when-animations-end.ts b/plugins/woocommerce/client/blocks/assets/js/base/utils/when-animations-end.ts
index 06ff621e55b..bd0a4ceb66f 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/utils/when-animations-end.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/base/utils/when-animations-end.ts
@@ -6,13 +6,16 @@
  * Call it after the style change that starts the motion. If a transition turns around while the script waits, the
  * script waits for the new one too.
  *
- * @param element  The element that animates.
- * @param callback Runs one time, when no animation of the element is in progress.
+ * @param element          The element that animates.
+ * @param callback         Runs one time, when no animation of the element is in progress.
+ * @param options          Options.
+ * @param options.subtree  Also wait for the animations of the element's descendants, such as rows that stagger in.
  * @return A function that cancels the callback.
  */
 export const whenAnimationsEnd = (
 	element: Element | null | undefined,
-	callback: () => void
+	callback: () => void,
+	{ subtree = false }: { subtree?: boolean } = {}
 ): ( () => void ) => {
 	let isCancelled = false;

@@ -25,7 +28,7 @@ export const whenAnimationsEnd = (
 		const animations =
 			typeof element?.getAnimations === 'function'
 				? element
-						.getAnimations()
+						.getAnimations( { subtree } )
 						.filter(
 							( animation ) =>
 								( animation.playState === 'running' ||
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/frontend.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/frontend.tsx
index b75d4972473..c273f8dbd5c 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/frontend.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/frontend.tsx
@@ -2,8 +2,14 @@
  * External dependencies
  */
 import { useStoreCart } from '@woocommerce/base-context/hooks';
-import { useEffect } from '@wordpress/element';
-import { dispatchEvent } from '@woocommerce/base-utils';
+import { useEffect, useLayoutEffect, useRef } from '@wordpress/element';
+import { useSelect } from '@wordpress/data';
+import { cartStore } from '@woocommerce/block-data';
+import {
+	dispatchEvent,
+	isKeyboardInput,
+	whenAnimationsEnd,
+} from '@woocommerce/base-utils';

 /**
  * Internal dependencies
@@ -18,6 +24,40 @@ const FrontendBlock = ( {
 	className: string;
 } ): JSX.Element | null => {
 	const { cartItems, cartIsLoading } = useStoreCart();
+	const removalCount = useSelect(
+		( select ) => select( cartStore ).getItemsPendingDelete().length,
+		[]
+	);
+	const isEmpty = ! cartIsLoading && cartItems.length === 0;
+	const ref = useRef< HTMLDivElement >( null );
+	const isPointerRemoval = useRef( false );
+	const previousRemovalCount = useRef( 0 );
+
+	// Read the input when a removal starts, such as Enter on Remove, so a click elsewhere while it is in flight
+	// does not change how the empty cart shows. Clear it when no removal is pending. This effect runs after the
+	// layout effect below, so the render that empties the cart still sees the removal.
+	useEffect( () => {
+		if ( removalCount > previousRemovalCount.current ) {
+			isPointerRemoval.current = ! isKeyboardInput();
+		} else if ( removalCount === 0 ) {
+			isPointerRemoval.current = false;
+		}
+		previousRemovalCount.current = removalCount;
+	}, [ removalCount ] );
+
+	// The empty cart rises in only when it replaces the cart after the shopper removes the last item with a pointer.
+	// A cart that loads empty, empties after a key press, or empties through another update shows immediately.
+	useLayoutEffect( () => {
+		const element = ref.current;
+		if ( ! isEmpty || ! element || ! isPointerRemoval.current ) {
+			return;
+		}
+		element.setAttribute( 'data-wc-entering', '' );
+		return whenAnimationsEnd( element, () =>
+			element.removeAttribute( 'data-wc-entering' )
+		);
+	}, [ isEmpty ] );
+
 	useEffect( () => {
 		if ( cartItems.length !== 0 || cartIsLoading ) {
 			return;
@@ -28,8 +68,12 @@ const FrontendBlock = ( {
 			),
 		} );
 	}, [ cartIsLoading, cartItems ] );
-	if ( ! cartIsLoading && cartItems.length === 0 ) {
-		return <div className={ className }>{ children }</div>;
+	if ( isEmpty ) {
+		return (
+			<div className={ className } ref={ ref }>
+				{ children }
+			</div>
+		);
 	}
 	return null;
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/style.scss
index 221d2e5765d..a271cdcc982 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/style.scss
@@ -2,3 +2,8 @@
 	margin-left: auto !important;
 	margin-right: auto !important;
 }
+
+// Rises in when it replaces the cart after the shopper removes the last item.
+.wp-block-woocommerce-cart .wp-block-woocommerce-empty-cart-block[data-wc-entering] {
+	@include motion-enter;
+}
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/test/frontend.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/test/frontend.tsx
new file mode 100644
index 00000000000..0c88d1a2d87
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/test/frontend.tsx
@@ -0,0 +1,157 @@
+/**
+ * External dependencies
+ */
+import { act, fireEvent, render, screen } from '@testing-library/react';
+import { dispatch } from '@wordpress/data';
+import { cartStore } from '@woocommerce/block-data';
+import { useStoreCart } from '@woocommerce/base-context/hooks';
+
+/**
+ * Internal dependencies
+ */
+import EmptyCart from '../frontend';
+
+jest.mock( '@woocommerce/base-context/hooks', () => ( {
+	useStoreCart: jest.fn(),
+} ) );
+
+// Keep the entrance attribute in place. jsdom has no animations, so it would be removed at once.
+jest.mock( '@woocommerce/base-utils', () => ( {
+	...jest.requireActual( '@woocommerce/base-utils' ),
+	whenAnimationsEnd: () => () => undefined,
+} ) );
+
+const mockCart = ( {
+	cartItems,
+	hasPendingItemsOperations = false,
+}: {
+	cartItems: Array< { key: string } >;
+	hasPendingItemsOperations?: boolean;
+} ) => {
+	( useStoreCart as jest.Mock ).mockReturnValue( {
+		cartItems,
+		cartIsLoading: false,
+		hasPendingItemsOperations,
+	} );
+};
+
+// A new element each time, so a rerender renders the block again.
+const emptyCartBlock = () => (
+	<EmptyCart className="wp-block-woocommerce-empty-cart-block">
+		<p>Empty Cart</p>
+	</EmptyCart>
+);
+
+// Remove marks the item as pending delete, which the cart reports as a pending item operation.
+const startRemoval = ( rerender: ( ui: JSX.Element ) => void ) => {
+	act( () => {
+		dispatch( cartStore ).itemIsPendingDelete( 'item' );
+	} );
+	mockCart( {
+		cartItems: [ { key: 'item' } ],
+		hasPendingItemsOperations: true,
+	} );
+	rerender( emptyCartBlock() );
+};
+
+const emptyCart = ( rerender: ( ui: JSX.Element ) => void ) => {
+	mockCart( { cartItems: [] } );
+	rerender( emptyCartBlock() );
+	act( () => {
+		dispatch( cartStore ).itemIsPendingDelete( 'item', false );
+	} );
+};
+
+const getEmptyCart = () =>
+	screen.getByText( 'Empty Cart' ).parentElement as HTMLElement;
+
+describe( 'Empty cart entrance', () => {
+	let removeButton: HTMLButtonElement;
+
+	beforeEach( () => {
+		removeButton = document.createElement( 'button' );
+		document.body.appendChild( removeButton );
+	} );
+
+	afterEach( () => {
+		removeButton.remove();
+	} );
+
+	it( 'rises in when a click removes the last item', () => {
+		mockCart( { cartItems: [ { key: 'item' } ] } );
+		const { rerender } = render( emptyCartBlock() );
+
+		fireEvent.pointerDown( removeButton );
+		fireEvent.click( removeButton, { detail: 1 } );
+		startRemoval( rerender );
+		emptyCart( rerender );
+
+		expect( getEmptyCart() ).toHaveAttribute( 'data-wc-entering' );
+	} );
+
+	it( 'shows at once when a cart update empties the cart without a removal', () => {
+		mockCart( { cartItems: [ { key: 'item' } ] } );
+		const { rerender } = render( emptyCartBlock() );
+
+		fireEvent.pointerDown( removeButton );
+		fireEvent.click( removeButton, { detail: 1 } );
+		mockCart( { cartItems: [] } );
+		rerender( emptyCartBlock() );
+
+		expect( getEmptyCart() ).not.toHaveAttribute( 'data-wc-entering' );
+	} );
+
+	it( 'shows at once when a cart update empties the cart after a click removal has finished', () => {
+		mockCart( { cartItems: [ { key: 'item' }, { key: 'other' } ] } );
+		const { rerender } = render( emptyCartBlock() );
+
+		fireEvent.pointerDown( removeButton );
+		fireEvent.click( removeButton, { detail: 1 } );
+		startRemoval( rerender );
+		mockCart( { cartItems: [ { key: 'other' } ] } );
+		rerender( emptyCartBlock() );
+		act( () => {
+			dispatch( cartStore ).itemIsPendingDelete( 'item', false );
+		} );
+
+		mockCart( { cartItems: [] } );
+		rerender( emptyCartBlock() );
+
+		expect( getEmptyCart() ).not.toHaveAttribute( 'data-wc-entering' );
+	} );
+
+	it( 'shows at once when a key press removes the last item, even after a click during the removal', () => {
+		mockCart( { cartItems: [ { key: 'item' } ] } );
+		const { rerender } = render( emptyCartBlock() );
+
+		fireEvent.keyDown( removeButton, { key: 'Enter' } );
+		fireEvent.click( removeButton, { detail: 0 } );
+		startRemoval( rerender );
+		fireEvent.pointerDown( document.body );
+		fireEvent.click( document.body, { detail: 1 } );
+		emptyCart( rerender );
+
+		expect( getEmptyCart() ).not.toHaveAttribute( 'data-wc-entering' );
+	} );
+
+	it( 'shows at once when a key press removes the last item during a pointer quantity update', () => {
+		mockCart( { cartItems: [ { key: 'item' } ] } );
+		const { rerender } = render( emptyCartBlock() );
+
+		// The shopper changes the quantity with the pointer. The update is still pending when they press Enter on Remove.
+		fireEvent.pointerDown( document.body );
+		fireEvent.click( document.body, { detail: 1 } );
+		mockCart( {
+			cartItems: [ { key: 'item' } ],
+			hasPendingItemsOperations: true,
+		} );
+		rerender( emptyCartBlock() );
+
+		fireEvent.keyDown( removeButton, { key: 'Enter' } );
+		fireEvent.click( removeButton, { detail: 0 } );
+		startRemoval( rerender );
+		emptyCart( rerender );
+
+		expect( getEmptyCart() ).not.toHaveAttribute( 'data-wc-entering' );
+	} );
+} );
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/status/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/status/style.scss
index da618182353..dc11a01d5a5 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/status/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/status/style.scss
@@ -33,3 +33,25 @@
 		}
 	}
 }
+
+// The sections rise in, 50ms apart, when the page loads. Fixed steps, not `nth-child`, because themes wrap and reorder
+// these blocks. Billing settles one step after shipping. This lives in Status because Status starts the template.
+$wc-order-confirmation-steps: (
+	"status": 0,
+	"status-description": 1,
+	"summary": 1,
+	"create-account": 2,
+	"totals-wrapper": 3,
+	"downloads-wrapper": 4,
+	"shipping-wrapper": 5,
+	"billing-wrapper": 6,
+	"additional-information": 6,
+	"additional-fields-wrapper": 6,
+);
+
+@each $name, $step in $wc-order-confirmation-steps {
+	.wc-block-order-confirmation-#{$name}:not(.editor-styles-wrapper *) {
+		--wc-motion-index: #{$step};
+		@include motion-enter($delay: motion-stagger-delay());
+	}
+}
diff --git a/plugins/woocommerce/client/blocks/docs/contributors/motion.md b/plugins/woocommerce/client/blocks/docs/contributors/motion.md
index c76ac2b3410..4465f1a6dc3 100644
--- a/plugins/woocommerce/client/blocks/docs/contributors/motion.md
+++ b/plugins/woocommerce/client/blocks/docs/contributors/motion.md
@@ -92,7 +92,8 @@ Motion that changes the layout runs in JavaScript, because it must measure sizes

 | Helper | Use |
 |--------|-----|
-| `whenAnimationsEnd( element, callback )` (`@woocommerce/base-utils`) | Runs `callback` when the animations of `element` end, instead of after a fixed timeout. It waits again if a transition turns around. It returns a function that cancels the callback. `whenAllAnimationsEnd( elements, callback )` waits for all of `elements`. |
+| `whenAnimationsEnd( element, callback, { subtree } )` (`@woocommerce/base-utils`) | Runs `callback` when the animations of `element` end, instead of after a fixed timeout. With `subtree`, it also waits for the animations inside `element`. It waits again if a transition turns around. It returns a function that cancels the callback. `whenAllAnimationsEnd( elements, callback )` waits for all of `elements`. |
+| `useListEntrance( ref )` (`@woocommerce/base-hooks`) | Lets the items of a list stagger in once. Call the function it returns when the items first show, such as from the `onShow` of `DelayedContentWithSkeleton`. It sets `data-wc-list-entering` on `ref` until the entrances end. Style the items with `motion-stagger` under that attribute. |
 | `usePresence( value, { animate, collapse } )` (`@woocommerce/base-hooks`) | Keeps content mounted while it animates out. Pass the content, or `null` to remove it. It returns `{ value, isExiting, ref }`. Put `ref` on the element that animates. Pass `collapse: true` to grow and collapse `ref` in the real layout. Pass `animate: false` to apply the change immediately, for example after a key press. |
 | `animateCollapse( element, isOpen, animate, from )` (`@woocommerce/base-utils`) | Grows `element` open or collapses it shut in the real layout, and turns around if it still moves. Give `element` the `motion-collapse` mixin. Use it through `usePresence` when the component owns the content. Pass `from`, such as `{ height: '20px' }`, to grow from the size of the content that `element` replaces, or to change the height of an element that stays. |
 | `collapseCopy( element )` (`@woocommerce/base-utils`) | Collapses an inert copy of `element` in its place, so that `element` can unmount at once. Call it just before `element` unmounts. If `element` grows again first, it grows from the copy. |
@@ -112,7 +113,7 @@ Find the change in this table, and use the helpers above.
 | A button shows a spinner | The label fades out, and the spinner grows in. |
 | A small icon, dot, or tick changes | It grows from a smaller size and fades in. |
 | Content appears in place, such as an empty state | It rises in and fades in. |
-| The rows of a list appear | The same rise, 50ms apart. A section that enters as one unit does not stagger its rows. |
+| The items of a list first show, on page load or in place of a skeleton | The same rise, 50ms apart, through `useListEntrance`. Content rendered on the server, such as order confirmation, can use `motion-stagger-delay()` alone. A section that enters as one unit does not stagger its items. |
 | A small item goes, such as a chip | It fades and shrinks in place. Then it unmounts. |
 | A dropdown opens from a field | It slides 4px from the field and fades in. It slides back to close. |
 | A toast or snackbar appears and goes | It rises in and drops out. |