Skip to content

Commit

Permalink
Match the front end layout classname in the editor. (#56774)
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines authored Dec 5, 2023
1 parent d703927 commit fc522ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
: layout || defaultBlockLayout || {};
const layoutClasses = useLayoutClasses( attributes, name );

const selectorPrefix = `wp-container-${ kebabCase( name ) }-layout-`;
// Higher specificity to override defaults from theme.json.
const selector = `.wp-container-${ id }.wp-container-${ id }`;
const selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
const hasBlockGapSupport = blockGapSupport !== null;

Expand All @@ -378,7 +379,7 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
const layoutClassNames = classnames(
{
[ `wp-container-${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.
[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.
},
layoutClasses
);
Expand Down

1 comment on commit fc522ee

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in fc522ee.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7107140015
📝 Reported issues:

Please sign in to comment.