Commit 18117503ae1 for woocommerce

commit 18117503ae1678c121ea5f25f45a85b7f8f46080
Author: Yuliyan Slavchev <yuliyan.slavchev@gmail.com>
Date:   Thu Nov 19 14:17:24 2026 +0200

    Open the email editor when clicking an email title in the listing (#71019)

    * Open the email editor when clicking an email title in the listing

    * Keep only the email title clickable in the listing

    * Remove unused email listing description styles

diff --git a/plugins/woocommerce/changelog/add-email-listing-clickable-title b/plugins/woocommerce/changelog/add-email-listing-clickable-title
new file mode 100644
index 00000000000..b84ffc1e13f
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-email-listing-clickable-title
@@ -0,0 +1,4 @@
+Significance: minor
+Type: enhancement
+
+Open the email editor by clicking an email title in the email settings list.
diff --git a/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-listing-listview.test.tsx b/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-listing-listview.test.tsx
index 62ecd083c8a..a18b0a8c5c8 100644
--- a/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-listing-listview.test.tsx
+++ b/plugins/woocommerce/client/admin/client/settings-email/__tests__/settings-email-listing-listview.test.tsx
@@ -23,10 +23,18 @@ type DataViewsAction = {

 // Captured on each render so tests can drive the actions directly.
 let capturedActions: DataViewsAction[] = [];
+let capturedOnClickItem: ( ( item: EmailType ) => unknown ) | undefined;

 jest.mock( '@wordpress/dataviews/wp', () => ( {
-	DataViews: ( { actions }: { actions: DataViewsAction[] } ) => {
+	DataViews: ( {
+		actions,
+		onClickItem,
+	}: {
+		actions: DataViewsAction[];
+		onClickItem?: ( item: EmailType ) => unknown;
+	} ) => {
 		capturedActions = actions;
+		capturedOnClickItem = onClickItem;
 		return null;
 	},
 } ) );
@@ -111,6 +119,7 @@ describe( 'ListView', () => {

 	beforeEach( () => {
 		capturedActions = [];
+		capturedOnClickItem = undefined;
 		useSendTestEmailMock.mockClear();
 		mockRecreateEmailPost.mockReset();

@@ -200,6 +209,38 @@ describe( 'ListView', () => {
 		} );
 	} );

+	describe( 'title click', () => {
+		it( 'opens the editor like the edit action', async () => {
+			render( <ListView emailTypes={ [ emailType ] } /> );
+
+			await capturedOnClickItem?.( emailType );
+
+			expect( window.location.href ).toBe(
+				'https://example.test/wp-admin/post.php?post=123&action=edit'
+			);
+		} );
+
+		it( 'lazily creates the post when no post exists', async () => {
+			mockRecreateEmailPost.mockResolvedValue( {
+				message: 'ok',
+				post_id: '456',
+			} );
+			const emailWithoutPost = {
+				...emailType,
+				post_id: '',
+				postStatus: null,
+			};
+			render( <ListView emailTypes={ [ emailWithoutPost ] } /> );
+
+			await capturedOnClickItem?.( emailWithoutPost );
+
+			expect( mockRecreateEmailPost ).toHaveBeenCalledWith( 'new_order' );
+			expect( window.location.href ).toBe(
+				'https://example.test/wp-admin/post.php?post=456&action=edit'
+			);
+		} );
+	} );
+
 	it( 'does not register a recreate-email-post action', () => {
 		render( <ListView emailTypes={ [ emailType ] } /> );

diff --git a/plugins/woocommerce/client/admin/client/settings-email/settings-email-listing-listview.tsx b/plugins/woocommerce/client/admin/client/settings-email/settings-email-listing-listview.tsx
index e852665b82b..fbaf153e796 100644
--- a/plugins/woocommerce/client/admin/client/settings-email/settings-email-listing-listview.tsx
+++ b/plugins/woocommerce/client/admin/client/settings-email/settings-email-listing-listview.tsx
@@ -1,7 +1,7 @@
 /**
  * External dependencies
  */
-import { useState, useMemo } from '@wordpress/element';
+import { useState, useMemo, useCallback } from '@wordpress/element';
 import { dispatch } from '@wordpress/data';
 import { pencil, external } from '@wordpress/icons';
 import { Icon } from '@wordpress/components';
@@ -82,6 +82,7 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 		page: 1,
 		perPage: 20,
 		titleField: 'title',
+		descriptionField: 'description',
 		showTitle: true,
 		layout: {},
 	} );
@@ -122,17 +123,12 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 				id: 'title',
 				label: __( 'Title', 'woocommerce' ),
 				enableHiding: false,
-				render: ( row: { item: EmailType } ) => {
-					return (
-						<div className="woocommerce-email-listing-title">
-							{ row.item.title }
-							<br />
-							<span className="woocommerce-email-listing-description">
-								{ row.item.description }
-							</span>
-						</div>
-					);
-				},
+			},
+			{
+				id: 'description',
+				label: __( 'Description', 'woocommerce' ),
+				enableHiding: false,
+				enableSorting: false,
 			},
 			{
 				id: 'recipients',
@@ -188,6 +184,47 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 		];
 	}, [ emailTypes ] );

+	const editEmail = useCallback(
+		async ( email: EmailType ) => {
+			if ( email.post_id ) {
+				window.location.href = getAdminLink(
+					`post.php?post=${ encodeURIComponent(
+						email.post_id
+					) }&action=edit`
+				);
+				return;
+			}
+			// Classic emails have no block template to edit; their
+			// settings live on the per-email section page.
+			if ( ! email.block_editor_supported ) {
+				window.location.href = getAdminLink(
+					`admin.php?page=wc-settings&tab=email&section=${ encodeURIComponent(
+						email.email_key
+					) }`
+				);
+				return;
+			}
+			// Lazily create the post (a draft with the file
+			// template content) and open it in the editor.
+			const response = await recreateEmailPost( email.id );
+			if ( response?.post_id ) {
+				window.location.href = getAdminLink(
+					`post.php?post=${ encodeURIComponent(
+						response.post_id
+					) }&action=edit`
+				);
+				return;
+			}
+			void dispatch( 'core/notices' ).createErrorNotice(
+				__(
+					'Could not prepare the email for editing. Please try again.',
+					'woocommerce'
+				)
+			);
+		},
+		[ recreateEmailPost ]
+	);
+
 	const actions = useMemo(
 		() => [
 			{
@@ -195,44 +232,7 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 				label: __( 'Edit', 'woocommerce' ),
 				icon: <Icon icon={ pencil } />,
 				supportsBulk: false,
-				callback: async ( items: EmailType[] ) => {
-					const email = items[ 0 ];
-					if ( email.post_id ) {
-						window.location.href = getAdminLink(
-							`post.php?post=${ encodeURIComponent(
-								email.post_id
-							) }&action=edit`
-						);
-						return;
-					}
-					// Classic emails have no block template to edit; their
-					// settings live on the per-email section page.
-					if ( ! email.block_editor_supported ) {
-						window.location.href = getAdminLink(
-							`admin.php?page=wc-settings&tab=email&section=${ encodeURIComponent(
-								email.email_key
-							) }`
-						);
-						return;
-					}
-					// Lazily create the post (a draft with the file
-					// template content) and open it in the editor.
-					const response = await recreateEmailPost( email.id );
-					if ( response?.post_id ) {
-						window.location.href = getAdminLink(
-							`post.php?post=${ encodeURIComponent(
-								response.post_id
-							) }&action=edit`
-						);
-						return;
-					}
-					void dispatch( 'core/notices' ).createErrorNotice(
-						__(
-							'Could not prepare the email for editing. Please try again.',
-							'woocommerce'
-						)
-					);
-				},
+				callback: ( items: EmailType[] ) => editEmail( items[ 0 ] ),
 			},
 			{
 				id: 'preview',
@@ -297,7 +297,7 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 				},
 			},
 		],
-		[ updateEmailEnabledStatus, recreateEmailPost ]
+		[ updateEmailEnabledStatus, editEmail ]
 	);

 	const form = {
@@ -311,6 +311,7 @@ export const ListView = ( { emailTypes }: { emailTypes: EmailType[] } ) => {
 			form={ form }
 			actions={ actions }
 			onChangeView={ setView }
+			onClickItem={ editEmail }
 			fields={ fields }
 			data={ emails ?? [] }
 			paginationInfo={ {
diff --git a/plugins/woocommerce/client/admin/client/settings-email/style.scss b/plugins/woocommerce/client/admin/client/settings-email/style.scss
index 0498fc72c10..3916f73373c 100644
--- a/plugins/woocommerce/client/admin/client/settings-email/style.scss
+++ b/plugins/woocommerce/client/admin/client/settings-email/style.scss
@@ -22,14 +22,6 @@
 			margin: 0;
 		}
 	}
-	.woocommerce-email-listing-description {
-		display: inline-block;
-		margin-top: 4px;
-		color: $gray-700;
-		font-size: 12px;
-		font-weight: 400;
-		white-space: wrap;
-	}
 	.woocommerce-email-listing-status {
 		svg {
 			fill: currentColor;