-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 alignment not working properly #39937
Comments
The cause of this issue is justify control in gutenberg button block. Alignment stylesheet get override by Justify control styles. There is solution for this, it more like a patch. Below style sheet will resolve the issue (See below screenshot for reference ) :
While testing this issue, i found out that when we change the justify on button block, alignment control get hidden. not sure why. also not sure why alignment control is added with justify. |
As it turns out if you toggle to center and then back to left it works. So the issue is that the default css applied does not match the default setting in the block. |
|
I'm having the same issue. Alignment doesn't work at all, no classes or attributes are appended in the output HTML after toggling these settings. |
I am not able to reproduce this in WordPress 6.0.2 with and without Gutenberg active. |
I have same issue on multiple websites after update to 6+. <!-- wp:buttons {"className":"","layout":{"type":"flex","justifyContent":"center","orientation":"horizontal"}} -->
<div class="wp-block-buttons"><!-- wp:button {"textColor":"white"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-white-color has-text-color wp-element-button" href="#in-kurze">Übersicht</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --> but on frontend it is like <div class="wp-block-buttons">
<div class="wp-block-button">
<a class="wp-block-button__link has-white-color has-text-color wp-element-button" href="#in-kurze">Übersicht</a>
</div>
</div> so there are missing classes like resaving does not help |
ok, my issue was, that I was using code to remove that Duotone SVG code generated below currently I use this and everythign works: remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
remove_action( 'in_admin_header', 'wp_global_styles_render_svg_filters' );
remove_action( 'wp_body_open', 'gutenberg_global_styles_render_svg_filters' );
remove_action( 'in_admin_header', 'gutenberg_global_styles_render_svg_filters' );
remove_filter( 'render_block', 'wp_render_duotone_support' ); I removed: remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_filter( 'render_block', 'wp_render_layout_support_flag' ); |
Tested again n WordPress 6.2 alpha without Gutenberg active: When I first add a button, the right align option is available. But if I then select the justify option, the right align option is gone from the toolbar. Screen.Recording.2023-02-07.at.10.35.55.mov |
@jasmussen Is the justification setting on the button block not intended to completely replace the align right/center/left option? |
Yes I would think so, part of that was discussed in #44614 as well. That is, through justification, button width, and text align, you should be able to accomplish the use cases shown on that issue. |
OK, I will wait until beta 1 and then test again, it is not working right now unless Gutenberg is activate. But we need to make sure the fix is in 6.2. |
I can confirm that in WordPress 6.2 beta 1, the button can use the width setting (25-100%), be aligned left right and center, and have a text align. It works in the editor and front. For example it is now possible to have a full with parent buttons block, with a 50% wide button block inside, that is justified to the right, with centered text: Note that the classname is
The centered text does not have a class, but if I align the text to the right, there is the
|
@HILAYTRIVEDI are you able to confirm as well that the bug has been solved? |
Hi @carolinan , Yes I can confirm that it is now fixed. |
Thank you, great, then we can close this issue. |
Description
The button block button is not aligning on the right side in the Twenty Twenty Two theme. It is aligning on the left and center but not on the right side.
Expected
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
https://www.awesomescreenshot.com/video/8161898?key=5213c5c3ccb17c0c2f23a3c97a583dae
Environment info
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
The text was updated successfully, but these errors were encountered: