Commit 5d978ecb945 for woocommerce
commit 5d978ecb945c2abfc86c271b18ca25771afdd4fe
Author: Rostislav Wolný <1082140+costasovo@users.noreply.github.com>
Date: Wed Nov 25 08:11:03 2026 +0100
[Email Editor] Wrap personalization tag categories so none are hidden (#70931)
* Wrap personalization tag categories in the email editor
With many personalization tag categories registered, the category row in the Personalization Tags modal could not wrap. It grew wider than the modal, so the last categories were cut off and only reachable by scrolling sideways. Letting the row wrap keeps every category visible. The existing Button block e2e test now mocks extra categories in the REST response, because WooCommerce's own categories fit on one row.
diff --git a/packages/js/email-editor/changelog/wooplug-8232-email-editor-some-personalization-tag b/packages/js/email-editor/changelog/wooplug-8232-email-editor-some-personalization-tag
new file mode 100644
index 00000000000..2224cf217b0
--- /dev/null
+++ b/packages/js/email-editor/changelog/wooplug-8232-email-editor-some-personalization-tag
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Wrap personalization tag categories onto more rows in the Personalization Tags modal so none are hidden.
diff --git a/packages/js/email-editor/src/components/personalization-tags/style.scss b/packages/js/email-editor/src/components/personalization-tags/style.scss
index df6b048ed6c..c0f4cb7721b 100644
--- a/packages/js/email-editor/src/components/personalization-tags/style.scss
+++ b/packages/js/email-editor/src/components/personalization-tags/style.scss
@@ -47,6 +47,8 @@
.woocommerce-personalization-tags-modal-menu {
div[role="group"] {
display: flex;
+ flex-wrap: wrap;
+ margin-block-start: 8px;
}
.woocommerce-personalization-tags-modal-menu-item-active {
diff --git a/plugins/woocommerce/tests/e2e/tests/email-editor/email-editor-loads.spec.ts b/plugins/woocommerce/tests/e2e/tests/email-editor/email-editor-loads.spec.ts
index 349e6a29f5d..4ed02a3ad1f 100644
--- a/plugins/woocommerce/tests/e2e/tests/email-editor/email-editor-loads.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/email-editor/email-editor-loads.spec.ts
@@ -270,6 +270,35 @@ test.describe(
// stays a merge: it is harmless, and removing it would be a behavior
// change in a title this batch does not otherwise touch.
await enableEmailEditor( baseURL );
+
+ // WooCommerce's own categories fit on one row, so mock extra ones in the
+ // REST response, as if extensions had registered them.
+ const extraCategories = [
+ 'Subscriber',
+ 'Subscription',
+ 'Membership',
+ 'Booking',
+ 'Coupon',
+ 'Affiliate',
+ ];
+ await page.route(
+ /v1(\/|%2F)personalization_tags/,
+ async ( route ) => {
+ const response = await route.fetch();
+ const tags = await response.json();
+ const extraTags = extraCategories.map( ( category ) => ( {
+ ...tags[ 0 ],
+ name: `${ category } tag`,
+ token: `[e2e/${ category.toLowerCase() }-tag]`,
+ category,
+ } ) );
+ await route.fulfill( {
+ response,
+ json: [ ...tags, ...extraTags ],
+ } );
+ }
+ );
+
await accessAndTrackEmailPost( page );
const canvas = page
.locator( 'iframe[name="editor-canvas"]' )
@@ -302,11 +331,31 @@ test.describe(
.getByRole( 'button', { name: 'Personalization Tags' } );
await expect( personalizationTagsButton ).toBeVisible();
- // Set a URL personalization tag as the button link.
await personalizationTagsButton.click();
await expect(
page.getByRole( 'heading', { name: 'Personalization Tags' } )
).toBeVisible();
+
+ // Every category stays visible, with no sideways scrolling.
+ const modal = page.locator(
+ '.woocommerce-personalization-tags-modal'
+ );
+ for ( const category of [ 'All', ...extraCategories ] ) {
+ await expect(
+ modal.getByRole( 'menuitem', {
+ name: category,
+ exact: true,
+ } )
+ ).toBeInViewport( { ratio: 1 } );
+ }
+ const horizontalOverflow = await modal
+ .locator( '.components-modal__content' )
+ .evaluate(
+ ( element ) => element.scrollWidth - element.clientWidth
+ );
+ expect( horizontalOverflow ).toBeLessThanOrEqual( 0 );
+
+ // Set a URL personalization tag as the button link.
await page
.locator(
'.woocommerce-personalization-tags-modal-category-group-item'