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

Cover Block missing margin in dimensions panel #41879

Closed
bradhogan opened this issue Jun 22, 2022 · 8 comments · Fixed by #41963
Closed

Cover Block missing margin in dimensions panel #41879

bradhogan opened this issue Jun 22, 2022 · 8 comments · Fixed by #41963
Assignees

Comments

@bradhogan
Copy link

Description

The cover block has padding, but not margin. It's helpful to eliminate the margin above and/or below a cover block in certain design cases. For example, if you have multiple cover blocks in a row with different background colors, it looks odd if you have the default theme blockgap in between each. For now, I add a class mt-0 or mb-0 but would love to see Margin added to the Dimensions panel.

Thanks!

Step-by-step reproduction instructions

  1. Add cover block with a black background
  2. Add second cover block right after with a red background
  3. Notice space in between with no way to remove the margin

Screenshots, screen recording, code snippet

Screen Shot 2022-06-22 at 9 43 55 AM

Screen Shot 2022-06-22 at 9 48 12 AM

Environment info

  • WP 6.0
  • Gutenberg 13.4.0
  • Mac
  • Chrome

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

@akasunil
Copy link
Contributor

Block dimension are used to manipulate block inner design, we cant set margin around the block with block setting. it should be handled by custom class as you have did.

@bradhogan
Copy link
Author

@sunil25393 Headings have a margin option as well which is not an inner design. I have to imagine I'm not the only designer who uses consecutive cover blocks and while it's easy for me to add a class like mt-0 or mb-0 in the Advanced panel, it's not intuitive for an end-user without design/dev experience to do so.

@HILAYTRIVEDI
Copy link
Contributor

I think it's an easy feature addition as in the latest versions of the Gutenberg by only adding the support for the Gutenberg in the block.json file will do the work. I tested that.

"spacing": { "padding": true, "__experimentalDefaultControls": { "padding": true }, "margin": true }

This will do the work.

@akasunil
Copy link
Contributor

akasunil commented Jun 24, 2022

@bradley2083 please check 33835 for more details.

@bradhogan
Copy link
Author

@HILAYTRIVEDI can you share your full block.json code? Where are you placing that, just in the main theme directory along with theme.json?

@bradhogan
Copy link
Author

@sunil25393 Yes, it seems as those multiple people were in favor of adding margin, then it got put on hold. Again, this is a UI issue when adding multiple / consecutive cover blocks. Most modern designs include this at some point in a design so it's odd that we wouldn't want to give WordPress creators an easy solution to preventing an odd margin between two heros/covers.

@ramonjd
Copy link
Member

ramonjd commented Jun 27, 2022

Hi folks!

As @sunil25393 mentioned, there was a previous PR to implement margins for cover block. There was, however, some uncertainty with how it would co-operate with the UI controls.

@jasmussen What do you think? Are those concerns still valid? Or does the benefit of controlling the top and bottom margins of cover blocks outweigh them at this stage?

It looks like the visualizer is looking better since #40505

2022-06-27 12 09 35

I've optimistically added a PR to add it back in #41963 😄

@bradhogan
Copy link
Author

Definitely not ideal, but here's what I'm adding to my theme for the time being until this gets added (fingers crossed).

.wp-block-cover + .wp-block-cover {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
} 

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants