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

Buttons Block: Extra vertical space between buttons in the Editor #28647

Closed
alaczek opened this issue Feb 2, 2021 · 8 comments
Closed

Buttons Block: Extra vertical space between buttons in the Editor #28647

alaczek opened this issue Feb 2, 2021 · 8 comments
Labels
[Block] Buttons Affects the Buttons Block CSS Styling Related to editor and front end styles, CSS-specific issues.

Comments

@alaczek
Copy link

alaczek commented Feb 2, 2021

Description

I noticed that when I insert Buttons block and set the buttons to 100% width, there's large vertical spacing between the buttons, to accommodate the block appender. This causes the editor view to be different than the preview. This behaviour is also different than if no width is set on the buttons - in that case no extra appenders appear between the buttons. This might be the intended behavior, but I found those differences confusing.

Step-by-step reproduction instructions

  1. Create a new post or a page.
  2. Add Buttons block with three to four buttons inside.
  3. Set each button to 100% width, so that each button sits on a separate line.
  4. Note that large vertical space between the buttons. If you hover over that space, a block appender will appear.
  5. Preview the site. Note that the spacing between the buttons is much smaller.
  6. Go back to the editor. De-select the width setting for each button, so that they all appear on the same line. Note the narrow spacing between buttons, and no appender when hovering over the spaces.
  7. Preview the site and note that the spacing between the buttons in the editor and in the preview are the same.

Expected behaviour

I didn't expect the extra vertical space in the editor when the button width is set to 100%.

Actual behaviour

I expected the spacing between the buttons to be the same in the preview and in the editor. I realize this will depend on the theme as well, but before this can be tackled in the theme, the issue of extra appenders needs to be hashed out.

Screenshots or screen recording (optional)

Editor view - large vertical spacing between buttons:
image

Preview - much smaller vertical spacing:
image

Here's a short video: https://www.loom.com/share/0f138caac58147a6ab0dc9564e950c9f

WordPress information

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

Device information

  • Device: Desktop
  • Operating system: macOS 10.15.7
  • Browser: Chrome 87.0
@skorasaurus skorasaurus added the [Block] Buttons Affects the Buttons Block label Feb 2, 2021
@paaljoachim paaljoachim added the CSS Styling Related to editor and front end styles, CSS-specific issues. label Feb 18, 2021
@paaljoachim
Copy link
Contributor

paaljoachim commented Feb 18, 2021

Thank you for creating the issue @alaczek !
I am also seeing this using Twenty Twenty One, Gutenberg plugin 10, and WordPress 5.7 beta 3.

Backend Twenty Twenty One:
Screen Shot 2021-02-18 at 13 09 24

Frontend:
Screen Shot 2021-02-18 at 13 09 39

@tellthemachines @carolinan

@paaljoachim
Copy link
Contributor

I did an inspect element on the backend and noticed this.

Screen Shot 2021-02-25 at 22 28 40

.editor-styles-wrapper [data-block] {
    margin-top: var(--global--spacing-vertical);
    margin-bottom: var(--global--spacing-vertical);
}

These margins should be collapsed making the backend look closer to the frontend.

Commenting out the above margins.

Screen Shot 2021-02-25 at 22 30 55

@ryelle
Copy link
Contributor

ryelle commented Feb 26, 2021

It turns out this is also the case with the default block-library styles (ex, Twenty Fifteen) - margins don't collapse between buttons in the editor, so each space between buttons has 2x margin, meanwhile on the frontend the margin is only applied to the bottom.

Screen Shot 2021-02-25 at 7 04 37 PM

Screen Shot 2021-02-25 at 7 24 07 PM

Could the margin top set here be removed or set to 0, maybe? Twenty Twenty & Twenty Twenty-One will still need to update too, since they set their own margins.

@jasmussen
Copy link
Contributor

Is this issue fixed by the new block spacing (gap) control?

Screenshot 2022-09-30 at 13 41 59

@paaljoachim
Copy link
Contributor

paaljoachim commented Oct 6, 2022

Testing using
Twenty Twenty Two.
WordPress 6.0.2
Gutenberg plugin 14.2

Testing instructions from original post
1- Create a new post or a page.
2- Add Buttons block with three to four buttons inside.
3- Set each button to 100% width, so that each button sits on a separate line.
4- Note that large vertical space between the buttons. If you hover over that space, a block appender will appear.

Getting the appender on hover in between the buttons is kind of tricky. It looks like I need to have the parent Buttons block selected for the appender on hover to show up.

Screenshot 2022-10-06 at 11 06 17

5- Preview the site. Note that the spacing between the buttons is much smaller.

I see an identical spacing on the frontend.
Screenshot 2022-10-06 at 10 53 44

6- Go back to the editor. De-select the width setting for each button, so that they all appear on the same line. Note the narrow spacing between buttons, and no appender when hovering over the spaces.

I am not able to get the appender on hover to be seen. Or it might just be difficult to get to show.

No appender on hover between the buttons.
Screenshot 2022-10-06 at 11 01 36

8- Preview the site and note that the spacing between the buttons in the editor and in the preview are the same.

Yes. I see the same identical buttons on the backend and frontend.

@paaljoachim
Copy link
Contributor

paaljoachim commented Oct 6, 2022

From what I am seeing the appender in between the buttons is having a hard time showing up and could be fixed.
We should close this issue and open a new issue in relation to getting a more stable appender in place which will easier show up between the buttons.

@jasmussen
Copy link
Contributor

Getting the appender to show between buttons in small-gap situations feels like a separate issue to being able to controlling the gap, right?

@paaljoachim
Copy link
Contributor

paaljoachim commented Oct 6, 2022

Yes. Here is the new issue for the in between appender: #44728

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block CSS Styling Related to editor and front end styles, CSS-specific issues.
Projects
None yet
Development

No branches or pull requests

5 participants