Skip to content

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Mar 5, 2025

What?

Closes #69414
Follow Up: #68819

This PR addresses the regressions introduced by #68819.

How?

Previously, the height property was used to apply a fallback default for spacer blocks within flex containers like Stack and Row.

Ref.

getSpacingPresetCssVar( finalHeight ) || DEFAULT_HEIGHT,

if ( isFlexLayout ) {
return DEFAULT_HEIGHT;
}

However, flex containers should use flex-basis instead of height. This PR corrects the implementation and fixes the associated bug.

Testing Instructions

Inserting a spacer inside a flex container

  1. Install WP version to 6.7 and disable the Gutenberg plugin.
  2. Insert Spacer block within Row/Stack.
  3. Change "Width" to "Fill".
  4. Save the post.
  5. Activate the Gutenberg plugin.
  6. Open the post.
  7. Verify that the Spacer block works fine.

Screencasts

Inserting "Hero, overlapped book cover with links" pattern from twenty-twenty-five theme

no-console-error.mov

Inserting spacer inside flex container (testing backward compatibility)

no-validation-errors-720p.mov

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Spacer Affects the Spacer Block labels Mar 5, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.8 Editor Tasks Mar 5, 2025
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review March 5, 2025 08:57
Copy link

github-actions bot commented Mar 5, 2025

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: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

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

@yogeshbhutkar yogeshbhutkar changed the title Regression: Properly Apply DEFAULT_HEIGHT in Flex Containers Spacer Block: Properly Apply DEFAULT_HEIGHT in Flex Containers Mar 5, 2025
@yogeshbhutkar yogeshbhutkar changed the title Spacer Block: Properly Apply DEFAULT_HEIGHT in Flex Containers Spacer Block: use flex-basis to apply DEFAULT_HEIGHT in Flex Containers Mar 5, 2025
@yogeshbhutkar yogeshbhutkar marked this pull request as draft March 5, 2025 09:46
@yogeshbhutkar yogeshbhutkar force-pushed the fix-69414/spacer-block-flex branch from 810da90 to 0cf86d1 Compare March 6, 2025 04:55
@Mamaduka
Copy link
Member

Mamaduka commented Mar 6, 2025

Should we close this PR and the associated issue now that the revert PR has been merged? Maybe also re-open the #68817.

@yogeshbhutkar
Copy link
Contributor Author

Yes, sure. Thanks for the heads up, @Mamaduka!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Spacer Affects the Spacer Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spacer: Spacer blocks in Row/Stack layouts may break when upgrading from WP 6.7
2 participants