Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform Styles: Update selector so that styles work when custom fields panel is active #62121

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`transformStyles URL rewrite should rewrite relative paths 1`] = `
]
`;

exports[`transformStyles error handling should handle multiple instances of \`:where(body)\` 1`] = `
exports[`transformStyles error handling should handle multiple instances of \`:root :where(body)\` 1`] = `
[
".my-namespace { color: pink; } .my-namespace { color: orange; }",
]
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/utils/test/transform-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe( 'transformStyles', () => {
);
} );

it( 'should handle multiple instances of `:where(body)`', () => {
const input = `:where(body) { color: pink; } :where(body) { color: orange; }`;
it( 'should handle multiple instances of `:root :where(body)`', () => {
const input = `:root :where(body) { color: pink; } :root :where(body) { color: orange; }`;
const output = transformStyles(
[
{
Expand Down
4 changes: 3 additions & 1 deletion packages/block-editor/src/utils/transform-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function transformStyle(
if ( ! wrapperSelector && ! baseURL ) {
return css;
}
const postcssFriendlyCSS = css.replace( /:where\(body\)/g, 'body' );
const postcssFriendlyCSS = css
.replace( /:root :where\(body\)/g, 'body' )
.replace( /:where\(body\)/g, 'body' );
try {
return postcss(
[
Expand Down
Loading