gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Group "Inherit default layout" is not applied to container

Open Sandstromer opened this issue 5 years ago • 1 comments

Description

When adding a group within a group, and selecting the "Inherit default layout" option, the default width is only applied to elements within the group container, and not the group container itself.

The average user would not notice as any content within the inner group is aligned with the default width. However when the inner group is given a background color, the issue becomes apparent, and it is noticeable that the group block is wider than the default width.

It seems that > * could be removed from lib/block-supports/layout.php L66 to target the group container itself, rather than only the elements within the group.

Step-by-step reproduction instructions

  1. Add/edit a post/page.
  2. Insert a group block
  3. Insert an inner group block within the first block
  4. In the inner group block, select the "Inherit default layout" option in the sidebar
  5. Add some content such as a paragraph to the inner group
  6. Notice how the default width is applied to the paragraph but not the group container

Expected behaviour

Actual behaviour

Screenshots or screen recording (optional)

inherit-default-layout

Code snippet (optional)

WordPress information

  • WordPress version: 5.7
  • Gutenberg version: 10.3.1
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1-Blocks

Device information

  • Device: Desktop
  • Operating system: W10
  • Browser: Firefox

Sandstromer avatar Apr 07 '21 14:04 Sandstromer

Upon looking into this, I think the "Inherit default layout" option is only supposed to target elements within the group container.

If one wants the group with the background color to be the same default width as the paragraph, it seems the answer is to add a third group block within the previous inner group block, or set the grandparent outer block to "Inherit default layout".

I'll close this as it seems to not be an issue requiring any fixing.

Sandstromer avatar Apr 07 '21 14:04 Sandstromer