From a489c0f531983e3c42bdd48db14f41c7a6bbc5fe Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 23 May 2024 13:23:36 +0100 Subject: [PATCH 1/2] Global Styles: Restore the default variation to the color and typography style tiles --- .../use-theme-style-variations-by-property.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js b/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js index d14cd8f64b2ccd..81a0ec10ed0758 100644 --- a/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +++ b/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js @@ -160,8 +160,12 @@ export default function useThemeStyleVariationsByProperty( { cloneDeep( variation ), property ); + // Remove variations that are empty once the property is filtered out. - if ( Object.keys( variationFilteredByProperty ).length === 0 ) { + if ( + variation.title !== 'Default' && + Object.keys( variationFilteredByProperty ).length === 0 + ) { return accumulator; } From 2cfcf6ba4e4f75b91b5872925d93eeb0e17e31a5 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 23 May 2024 16:48:42 +0100 Subject: [PATCH 2/2] find the default variation with i18n --- .../use-theme-style-variations-by-property.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js b/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js index 81a0ec10ed0758..2a914efc6ee526 100644 --- a/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +++ b/packages/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js @@ -163,7 +163,7 @@ export default function useThemeStyleVariationsByProperty( { // Remove variations that are empty once the property is filtered out. if ( - variation.title !== 'Default' && + variation.title !== __( 'Default' ) && Object.keys( variationFilteredByProperty ).length === 0 ) { return accumulator;