Social icons alignment issue when it wrap inside group block
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
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.
Related https://github.com/WordPress/gutenberg/issues/39344
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;
}
}
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;
}
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.
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.
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
- ✅ Error condition occurs (reproduced).
Additional Notes
- Any additional details worth mentioning.
Supplemental Artifacts
https://github.com/user-attachments/assets/c337b1b5-f905-4967-95ab-e23b661218d4
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
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.