diff --git a/packages/block-editor/src/components/global-styles/advanced-panel.js b/packages/block-editor/src/components/global-styles/advanced-panel.js index 1ad59451d1468a..bbb756cd78247d 100644 --- a/packages/block-editor/src/components/global-styles/advanced-panel.js +++ b/packages/block-editor/src/components/global-styles/advanced-panel.js @@ -28,9 +28,12 @@ export default function AdvancedPanel( { css: newValue, } ); if ( cssError ) { + // Check if the new value is valid CSS, and pass a wrapping selector + // to ensure that `transformStyles` validates the CSS. Note that the + // wrapping selector here is not used in the actual output of any styles. const [ transformed ] = transformStyles( [ { css: newValue } ], - '.editor-styles-wrapper' + '.for-validation-only' ); if ( transformed ) { setCSSError( null ); @@ -43,9 +46,12 @@ export default function AdvancedPanel( { return; } + // Check if the new value is valid CSS, and pass a wrapping selector + // to ensure that `transformStyles` validates the CSS. Note that the + // wrapping selector here is not used in the actual output of any styles. const [ transformed ] = transformStyles( [ { css: event.target.value } ], - '.editor-styles-wrapper' + '.for-validation-only' ); setCSSError(