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

Button block: add text alignment options #8780

Closed
ZebulanStanphill opened this issue Aug 9, 2018 · 8 comments
Closed

Button block: add text alignment options #8780

ZebulanStanphill opened this issue Aug 9, 2018 · 8 comments
Labels
[Block] Buttons Affects the Buttons Block [Type] Enhancement A suggestion for improvement.

Comments

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Aug 9, 2018

The Button block currently has the ability to be floated to the left or right, as well as the ability to be center-aligned. However, there are situations where you want to have a button shown on the right, but you do not want the wrapping behavior of floats. Therefore, I think the Button block should have text alignment options.

Notably, I am not asking that the float alignment controls be removed. I am asking that text alignment controls be provided in addition to the float alignment controls.

@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks labels Aug 9, 2018
@designsimply
Copy link
Member

Screenshot for reference:

screen shot 2018-08-09 at thu aug 9 11 09 33 am

Seen at http://alittletestblog.com/wp-admin/post.php?post=14188&action=edit running WordPress 4.9.8 and Gutenberg 3.4.0 using Firefox 61.0.1 on macOS 10.13.6.

@webtrainingwheels
Copy link

Just to connect the dots.... . A couple of related issues about float/alignment behaviour
#10299
#4127

@noisysocks noisysocks added the [Block] Buttons Affects the Buttons Block label Nov 2, 2018
@designsimply designsimply removed the [Feature] Blocks Overall functionality of blocks label Feb 8, 2019
@designsimply
Copy link
Member

there are situations where you want to have a button shown on the right, but you do not want the wrapping behavior of floats

I am not sure this is likely to be a common enough request to warrant changing the toolbar and I think it might lead to confusion since the expectation for text alignment could be that it operates on the text of the button itself and not on the alignment of the button. I think it would be reasonable, for cases such as you've suggested, to use the "Additional CSS Class" field and some custom CSS to make the desired change. If you feel strongly that is not the case and you feel strongly that adding text alignment options to the button block for layout controls such as showing a button on the right without floating it, please reply back and let me know and I will re-open the issue for you. Thank you!

@ZebulanStanphill
Copy link
Member Author

I think the main issue here is that there is no way to align a block to the left or right without also floating it. You can get away with not having a left align option in most cases because most sites default to displaying something on the left, but this is not the cause for RTL sites (or sites that support both LTR and RTL modes). I'm mainly thinking in terms of page building, e.g. the following:
image

The middle section includes a button (technically a link... but so is the core Button block) right-aligned along with the rest of the content in that section to provide some visual contrast against the sections above and below.

Technically I could have right-floated that button and it would work, but not if there was anything below it in that section... unless the thing following it was using the clear css property. But there's no easy way to set a block to clear the previous one in Gutenberg without resorting to a CSS class, and it's far from an intuitive experience, since floats are not intended for situations like this.

This issue isn't really specific to buttons, as it affects any block that you want to align to the left or right edge of its container. Because of that, I expect this issue will end up having to be tackled anyway as things like the core Container block (and any other layout-related blocks) are developed and Gutenberg moves into full page building territory.

So I'm fine with this issue being closed. Adding text alignment options to solve this issue specifically for the Button block feels like a bit of a hack in hindsight, and a proper solution will probably appear in the near (or maybe not-so-near) future anyway.

@designsimply
Copy link
Member

Agree about exploring it on a larger scale and also about container block as a possible place to tackle it. Thanks for the follow-up!

@buhlahkay
Copy link

This comes up all the time for me. I frequently need to right align a button, but I've never needed to float it to the right. I think text alignment makes more sense than it's current treatment.

@ghost
Copy link

ghost commented Apr 19, 2020

not this option was gone from Gutenberg to align button in the centre

@davidperezgar
Copy link
Member

Please, add again this feature

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 [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants