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 alignments break when updating to recent version #21707

Closed
joshm33333 opened this issue Apr 18, 2020 · 4 comments
Closed

Buttons alignments break when updating to recent version #21707

joshm33333 opened this issue Apr 18, 2020 · 4 comments
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Buttons Affects the Buttons Block [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@joshm33333
Copy link

If you made a site using a version of Gutenberg before the buttons group was added, for a while it was ok. Gutenberg has a policy of not forcefully updating any blocks until you manually approve it. However, buttons no longer wait for approval.

I have buttons, that used the old html of <div class='wp-block-button'><a class='wp-block-button__link'></a></div> and in recent updates the containing div was removed and the classes combined on the 'a' element. I get what's happening, you expect me to use the 'buttons' group in place of the containing div.

The problem is that the buttons block is not automatically inserted, but the button block is forcefully modified to require it. The biggest issue is alignment. Every single button on every site that used to be center aligned is now left aligned. I have thousands of buttons, and I'm supposed to go back and manually fix them all? Which I would do, no problem, except now I'm starting to think why bother when Gutenberg might just screw me again later. That's why I'm reporting this as a bug, because if this is the policy of Gutenberg updates, then I don't think I'm going to keep using it.

To reproduce
Make a button in an old version of Gutenberg, center align, then update to the latest version and see it become left aligned on the front end

Expected behavior
Don't make changes to the front end until I review each instance of the issue

Screenshots
code

  • WordPress: 5.4
  • Gutenberg: 7.9.1
  • OS: Windows 10
  • Browser: Edge BETA
@joshm33333
Copy link
Author

joshm33333 commented Apr 18, 2020

I'm using a workaround
a.wp-button-link{ display: table; }
for some reason display table on an A tag make the element tag the size of its content and center in its parent

obviously this is unreliable for browser support, but its better than fixing everything by hand for the time being

@talldan talldan added [Block] Buttons Affects the Buttons Block [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability labels Apr 20, 2020
@talldan
Copy link
Contributor

talldan commented Apr 20, 2020

@joshm33333, In my testing in a couple of themes (Gutenberg Starter Theme, Twenty Twenty), it does indeed look like alignments aren't working. This wouldn't have been done on purpose, so apologies if this has caused issues.

My steps to reproduce:

  1. Add an aligned button block by adding the following to the Code Editor:
<!-- wp:button {"align":"center"} -->
<a class="wp-block-button aligncenter wp-block-button__link">test</a>
<!-- /wp:button -->
  1. Preview the post

In my case, this is what I see in the post:
Screenshot 2020-04-20 at 5 04 28 pm

In the starter theme I get a slightly different result, the button is full-width in the post.

@talldan talldan changed the title Buttons break when updating to recent version Buttons alignments break when updating to recent version Apr 20, 2020
@kjellr
Copy link
Contributor

kjellr commented Apr 22, 2020

Is this a duplicate of #21685?

@talldan
Copy link
Contributor

talldan commented Apr 23, 2020

Looks like it, lets close this one in favour of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Buttons Affects the Buttons Block [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants