Skip to content

Update child layout selector to match core.#61777

Merged
tellthemachines merged 1 commit into
trunkfrom
update/child-layout-selector
May 18, 2024
Merged

Update child layout selector to match core.#61777
tellthemachines merged 1 commit into
trunkfrom
update/child-layout-selector

Conversation

@tellthemachines

Copy link
Copy Markdown
Contributor

What?

Syncing a change that was made in the core sync PR for grid and column spans.

Using wp_unique_id to generate the child layout classname number means that number will vary depending on how many times wp_unique_id has been used on the page before. This was causing the results of the test added in #61392 to be unpredictable, and also the classname of any given block on a page to be unpredictable, which could affect things like dynamic loading (see #55416).

This PR changes the child layout classname to use wp_unique_prefixed_id instead.

Testing Instructions

Nothing should have visibly changed, but if you

  1. Create a post with:
    • an Image block with a custom duotone filter applied (choose the colors yourself, don't use the preset);
    • a Row block with a few children, and set one of the children to "Fill" under Dimensions;
  2. Create a custom template for that post that contains only the Post Content block;
  3. Save and view on the front end. The classname for the Row child set to Fill should be wp-container-content-1 (in trunk it'll be wp-container-content-2 because the duotone filter also uses wp_unique_id).

Testing Instructions for Keyboard

Screenshots or screencast

@tellthemachines tellthemachines added Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Layout Layout block support, its UI controls, and style output. labels May 18, 2024
@tellthemachines tellthemachines self-assigned this May 18, 2024
@github-actions

github-actions Bot commented May 18, 2024

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

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

@github-actions

Copy link
Copy Markdown

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/block-supports/layout.php
❔ phpunit/block-supports/layout-test.php

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Working nicely. LGTM! 🚀

@tellthemachines tellthemachines merged commit af5876a into trunk May 18, 2024
@tellthemachines tellthemachines deleted the update/child-layout-selector branch May 18, 2024 23:22
@github-actions github-actions Bot added this to the Gutenberg 18.5 milestone May 18, 2024
patil-vipul pushed a commit to patil-vipul/gutenberg that referenced this pull request Jun 17, 2024
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Layout Layout block support, its UI controls, and style output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants