gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Social icons alignment issue when it wrap inside group block

Open theminaldiwan opened this issue 4 years ago • 9 comments

Description

This is occur when we wrap social icon block inside group block and changing social icon alignment from left or right and applied background color to group block.We need to cover full background color to social icon.

Step-by-step reproduction instructions

1.First we have to add group block and checking it in twenty twenty two theme. 2.Adding Social icon block inside group block. 3.Applying background color to group block and changing social icon block alignment to left or right.

Screenshots, screen recording, code snippet

Follow Recording:https://www.loom.com/share/dfd7d45333f644309342769a529e63be

Environment info

No response

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

theminaldiwan avatar Apr 07 '22 07:04 theminaldiwan

I can reproduce this on Gutenberg trunk with WordPress 6.0-alpha-52931.

This seems to be caused by the use of float when changing the alignment. If an inner element is bigger than its parent, and we add a float property to it, the parent spacing will collapse.

There are many ways to fix that, once being to add overflow: auto to the parent. Another is to add some property to a pseudo-element of the parent:

.parent:after {
  content: "";
  display: table;
  clear: both;
}

See https://css-tricks.com/snippets/css/clear-fix.

JustinyAhin avatar Apr 07 '22 09:04 JustinyAhin

Related https://github.com/WordPress/gutenberg/issues/39344

JustinyAhin avatar Apr 07 '22 09:04 JustinyAhin

Hi @JustinyAhin

Yes I have also solution for this issue but i'm facing some issue in pull request. Path:gutenberg/packages/block-library/src/social-links/style.scss

.wp-block-group .wp-block-social-links { &.alignleft, &.alignright { float: none; } }

theminaldiwan avatar Apr 08 '22 09:04 theminaldiwan

Hi @theminaldiwan, Insted of giving the float none. It will be more convenient to add the auto to the parent div .wp-block-group { overflow: auto; }

HILAYTRIVEDI avatar Jun 02 '22 07:06 HILAYTRIVEDI

Hi @JustinyAhin and @theminaldiwan, Actually this issue is of group block. And as @JustinyAhin mentioned the issue: https://github.com/WordPress/gutenberg/issues/39344 that the same thing is happening when we add other blocks like image block. So I created PR for the group block and it is solving both the issue with just 1 line of CSS.

Thank you.

Smit2808 avatar Aug 03 '22 08:08 Smit2808

I am not able to reproduce this on WP 6.7.1 with Twenty Twenty-Five, Twenty-Twenty-Two or Twenty Twenty-One. I believe this has already been fixed.

carolinan avatar Dec 06 '24 07:12 carolinan

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.9-alpha-60342
  • PHP: 8.2.28
  • Server: Apache/2.4.62 (Debian)
  • Database: mysqli (Server: 11.8.2-MariaDB-ubu2404 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 138.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-One 2.5
  • MU Plugins:
    • Gutenberg Test Plugin, Disable Login Autofocus
    • Gutenberg Test Plugin, Disable Remote Patterns
    • Gutenberg Test Plugin, Enable Templates UI
    • Gutenberg Test Plugin, No-cache Headers
    • Gutenberg Test Plugin, Normalize Theme
    • server-timing.php
  • Plugins:
    • Gutenberg 21.1.0-rc.1
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • Any additional details worth mentioning.

Supplemental Artifacts

https://github.com/user-attachments/assets/c337b1b5-f905-4967-95ab-e23b661218d4

R1shabh-Gupta avatar Jun 30 '25 10:06 R1shabh-Gupta

I was able to reproduce the issue, and as noted, it also affects other blocks. The bug needs a more general resolution than proposed in #40226.

Screenshot

Image

Mamaduka avatar Aug 04 '25 07:08 Mamaduka

I am working on this issue. The root cause is that flow and constrained layout containers apply float to .alignleft/.alignright children but never establish a Block Formatting Context (BFC) to contain those floats, causing the parent's background to collapse.

Mustafabharmal avatar Feb 25 '26 21:02 Mustafabharmal