From 873b7bc28306b12b1a678d394adfc6c069d005e0 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Thu, 28 Mar 2024 16:29:25 +1100 Subject: [PATCH] Reset specificity of body selector when processing with postcss. (#60266) Co-authored-by: tellthemachines Co-authored-by: andrewserong --- packages/block-editor/src/utils/transform-styles/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/utils/transform-styles/index.js b/packages/block-editor/src/utils/transform-styles/index.js index 808566776f6ea..129a4cd0e3e7b 100644 --- a/packages/block-editor/src/utils/transform-styles/index.js +++ b/packages/block-editor/src/utils/transform-styles/index.js @@ -19,6 +19,7 @@ function transformStyle( return css; } + const postcssFriendlyCSS = css.replace( ':where(body)', 'body' ); try { return postcss( [ @@ -31,7 +32,7 @@ function transformStyle( } ), baseURL && rebaseUrl( { rootUrl: baseURL } ), ].filter( Boolean ) - ).process( css, {} ).css; // use sync PostCSS API + ).process( postcssFriendlyCSS, {} ).css; // use sync PostCSS API } catch ( error ) { if ( error instanceof CssSyntaxError ) { // eslint-disable-next-line no-console