Skip to content

Add support for layout responsive styles#11966

Closed
tellthemachines wants to merge 6 commits into
WordPress:trunkfrom
tellthemachines:add/layout-responsive-styles
Closed

Add support for layout responsive styles#11966
tellthemachines wants to merge 6 commits into
WordPress:trunkfrom
tellthemachines:add/layout-responsive-styles

Conversation

@tellthemachines

@tellthemachines tellthemachines commented May 26, 2026

Copy link
Copy Markdown
Contributor

Trac ticket: https://core.trac.wordpress.org/ticket/65164

Use of AI Tools

Code copied across from WordPress/gutenberg#78543 with the aid of copilot. Verified manually by a human (me).

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@tellthemachines

Copy link
Copy Markdown
Contributor Author

noting that WordPress/gutenberg#78543 also has a change to the states block support that is dependent on #11828 which introduces the file.

@tellthemachines tellthemachines force-pushed the add/layout-responsive-styles branch from 9c505b7 to eaa2a2f Compare June 4, 2026 01:14
@tellthemachines tellthemachines self-assigned this Jun 4, 2026
@tellthemachines tellthemachines marked this pull request as ready for review June 4, 2026 04:19
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props isabel_brison, ramonopoly.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Aside from the regex, everything looks to be a faithful port. Cheers!


/**
* Returns the child-layout-only subset of a layout object.
*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@since 7.1.0?

Comment on lines +80 to +90
function wp_sanitize_block_gap_value( $gap_value ) {
if ( is_array( $gap_value ) ) {
foreach ( $gap_value as $key => $value ) {
$gap_value[ $key ] = $value && preg_match( '%[\\(&=}]|/\*%', $value ) ? null : $value;
}

return $gap_value;
}

return $gap_value && preg_match( '%[\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Gutenberg PR also uses three backslashes in source:

gutenberg: '%[\\\(&=}]|/\*%'

Here I see only two. I think this means it no longer rejects CSS gap values that contain a literal backslashes? Worth checking or creating a unit test if this version is right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh well spotted, it should definitely be like the gutenberg version, which also matches the existing logic in core that this function is supposed to extract 🤦

* @since 5.9.0
* @since 6.1.0 Added `$block_spacing` param, use style engine to enqueue styles.
* @since 6.3.0 Added grid layout type.
* @since 6.6.0 Removed duplicated selector from layout styles.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@since blah

* so it shares a selector with the base layout (the inner block wrapper for
* wrapper blocks) instead of being scoped to a separate `wp-states-...` class.
*
* @covers ::wp_render_layout_support_flag

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ticket 65164 etc

@tellthemachines

Copy link
Copy Markdown
Contributor Author

Thanks for the review @ramonjd! Everything should be fixed now.

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - thanks for the update.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62478
GitHub commit: 46329b6

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants