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

Global padding not applied in nested constrained group block with alignfull #59850

Closed
huubl opened this issue Mar 13, 2024 · 5 comments
Closed
Labels
[Block] Group Affects the Group Block [Feature] Layout Layout block support, its UI controls, and style output. Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@huubl
Copy link
Contributor

huubl commented Mar 13, 2024

Description

I am currently working on a template where I have content inside a constrained group block with alignfull. This block is nested within another constrained group block. The global padding is not being applied as expected.

Step-by-step reproduction instructions

  1. Open this Playground link
  2. Paste and run:
{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "landingPage": "/wp-admin/site-editor.php?postType=wp_template&postId=twentytwentyfour//page",
  "phpExtensionBundles": [
    "kitchen-sink"
  ],
  "preferredVersions": {
    "php": "8.1",
    "wp": "latest"
  },
  "features": {
    "networking": true
  },
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    },
    {
      "step": "installPlugin",
      "pluginZipFile": {
        "resource": "wordpress.org/plugins",
        "slug": "gutenberg"
      }
    },
    {
      "step": "writeFile",
      "path": "/wordpress/wp-content/themes/twentytwentyfour/templates/page.html",
      "data": "<!-- wp:group {\"tagName\":\"main\",\"layout\":{\"type\":\"constrained\"}} -->\r\n<main class=\"wp-block-group\"><!-- wp:post-title /-->\r\n<!-- wp:paragraph -->\r\n<p>Constrained group block: global padding works here.</p>\r\n<!-- /wp:paragraph -->\r\n<!-- wp:group {\"align\":\"full\",\"backgroundColor\":\"accent-3\",\"layout\":{\"type\":\"constrained\"}} -->\r\n<div class=\"wp-block-group alignfull has-accent-3-background-color has-background\"><!-- wp:paragraph -->\r\n<p>Constrained group block with alignfull, that's a innerblock of the group above: The global padding doesn’t work in both the site editor and the frontend.</p>\r\n<!-- /wp:paragraph -->\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\">Editor:</h2>\r\n<!-- /wp:heading -->\r\n<!-- wp:paragraph -->\r\n<p>If you switch the device view to mobile, you’ll notice the absence of padding.</p>\r\n<!-- /wp:paragraph -->\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\">Frontend:</h2>\r\n<!-- /wp:heading -->\r\n<!-- wp:paragraph -->\r\n<p>To observe this on the frontend, navigate to the “Sample page” and use the inspector to resize the screen to a mobile view.</p>\r\n<!-- /wp:paragraph --></div>\r\n<!-- /wp:group --></main>\r\n<!-- /wp:group -->"
    }
  ]
}

Screenshots, screen recording, code snippet

image

Environment info

  • Wordpress: 6.4.3
  • Gutenberg: 17.9.0
  • Twenty Twenty-Four: 1.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@huubl huubl added the [Type] Bug An existing feature does not function as intended label Mar 13, 2024
@jordesign jordesign added [Block] Group Affects the Group Block Needs Testing Needs further testing to be confirmed. labels Mar 13, 2024
@ramonjd ramonjd added the [Feature] Layout Layout block support, its UI controls, and style output. label Mar 14, 2024
@andrewserong
Copy link
Contributor

From a bit of reading, I believe the use root padding aware alignments feature is only meant to apply to container blocks at the root of the template. Nested blocks don't receive the padding rules, and stretch to the edges of template, and it seems to be by design. It's mentioned in some of the code comments, e.g.:

// Nested containers with `.has-global-padding` class do not get padding.

And at the end of the theme documentation on "Use Root Padding Aware Alignments": https://developer.wordpress.org/themes/global-settings-and-styles/settings/use-root-padding-aware-alignments/

@huubl
Copy link
Contributor Author

huubl commented Mar 17, 2024

I overlooked the documentation about this, thanks for pointing me to it.

However, it does feel counterintuitive that nested container blocks, like the group and cover block, with 'alignfull' do not inherit the root padding.

Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Apr 17, 2024
@kimmenbert
Copy link

Looks to me that this: #60715 is made to tackle this

@github-actions github-actions bot removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jun 13, 2024
@huubl
Copy link
Contributor Author

huubl commented Jun 17, 2024

Looks to me that this: #60715 is made to tackle this

Yes, it seems #60715 fixed this issue!

@huubl huubl closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Group Affects the Group Block [Feature] Layout Layout block support, its UI controls, and style output. Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
5 participants