-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Gutenberg: Cannot center-align image on certain themes #28756
Comments
Another instance here, and few notes:
Looks like we also add a display: block to the figure, so if we don't give it a width then it's gonna default to 100% and margin: auto won't really apply. |
I think the display issues here may both be theme-related. We've had a couple other reports, with Dara, Baskerville 2, and Manifest, where the issue is that the class @KokkieH the user that reported the issue in that thread was using Dara, which we've fixed. Do you happen to remember the other themes you recreated this with? @supernovia Looking at https://silverwilderness.wordpress.com/2018/11/28/romance-in-ya-is-not-realistic/, I think the issue is coming from these styles in the theme: https://github.com/Automattic/themes/blob/master/libre-2/css/blocks.css#L78-L83. I'm going to make a new issue for that, for us to investigate. If we can confirm all the themes used for reproducing this issue include some kind of problem styles instead of them coming from WP.com, we can close this issue :) |
@laurelfulford, my test site where I confirmed this is coincidentally also on Dara, so I did not think to try this on different themes. In that case, I've had a report in the WordPress.org forums as well, though I wasn't able to replicate this on a self-hosted site with Dara. |
Thanks @KokkieH!
Okay, I think that's a good sign (or at least a sign in favour of the problem being a theme thing). The problem code in Dara's case was added with some other Gutenberg-related styles. We've been holding off submitting those updates to WP.org, at least until 5.0 is officially released, to see if we can catch some bugs (like this!) in advance. |
In Wordpress 5.01, this happens to me on all my sites where I use Gutenberg. Before upgrading to 5.0, it worked fine. Buttons and images simply do not center. |
Another case, on a site with the Baskerville 2 theme:
|
Attache also has this issue: This fixes it, but probably not the best route:
|
Also an issue in https://wordpress.com/theme/professional-business investigating CSS workaround for now. |
@automattic-ian I'm not able to reproduce an issue with centre image alignment at any screen ratio with that theme. By any chance, are you referring to the Sophisticated Business theme? I've proposed a fix for that one at Automattic/themes#648, and it's being tracked at Automattic/themes#646. |
@torres126 it appears that I may have been mistaken and that this is a separate issue, it seems to only impact image galleries, not single images, as seen here: Where you can see the class .aligncenter however the gallery is still pushed to the left. |
Thanks @automattic-ian! I can reproduce, PR for that issue in Automattic/themes#660. |
Another site that was affected #1885592-zd |
Another on #1847494-zen with tiled galleries, I provided this CSS to resolve it:
|
@katinthehatsite @mikeicode Just out of curiosity, which theme(s)? |
|
@torres126 For my case, it was theme Veni: https://wordpress.com/theme/veni |
Another issue reported in 1988165-zen for [Port theme](https://wordpress.com/theme/port]. |
I had another report on 12365791-hc where |
Another report in #13689395-hc Theme - Baskerville 2. I employed temp solution seen in GH-403 |
I seem to be having this issue in the October theme. from playing with the css the only way I can get images to centre is at row level and by removing the display:flex, which isn't ideal |
@nathalieflower I think you might be in the wrong repository. This issue is specifically regarding an issue with the block editor and some specific themes on WordPress.com, and October is not a theme offered on WordPress.com. It would probably be best to contact support for your theme directly about this, as if it's a theme issue, a fix we apply on WordPress.com won't have any effect on your theme. |
Another report for the Veni theme, on 15730086-hc. |
Same issue here with Sydney. |
Just tested on two of my sites running the same versions of everything. Same issue. This needs to be fixed. |
Testing further with various themes, this does appear to be a Gutenberg issue, not a theme issue. I can set an image to align right, and it does. Aligning center does nothing. Please fix this. |
Unless something has changed recently (which I'm pretty sure it hasn't), then this is still a theme issue that generally needs fixing in individual themes. Sydney isn't a theme available on WordPress.com though, and it's probably best to contact the developer of that theme, since any changes to WordPress.com won't have an impact on that. |
As I said, I tested multiple themes. Which theme are you using without problems?
|
I should also specify, this is on a self hosted installation. Two self hosted installations actually.
|
I use the Harmonic theme on WordPress.com. I can test Sydney on a self-hosted site at some point tomorrow to see if I can reproduce it, but for now, virtually no theme seems to still have this issue. |
@Aurorum, I don't think it's a theme issue. I just tested with Twenty Nineteen, SmartTheme, Sydney, Twenty Fifteen, Twenty Seventeen, Twenty Sixteen, OceanWP. It's not a theme problem. This is across multiple WP installations. Everything up to date. Various themes. |
This is the code of an image that will not center:
Now, if I add |
Ok. Update. It's not a theme issue, but for me at least it was an Elementor issue. It appears Elementor is overriding Gutenberg's alignment. So I added this CSS:
That seems to have fixed it for me. So it looks like something Elementor needs to fix. |
Got another report on 2602696-zen with the Cubic theme. |
This has fixed for me too, add this line into "Appearance > Customize > Additional CSS" |
Got another report on 17773353-hc with the Didi theme, now on a Video block. |
I've run into this a few times on internal Automattic P2 sites; where the P2 Breathe theme existing CSS doesn't seem to correctly center the image as expected — and also the image caption itself wasn't centered; which should be a basic theme style. |
@lancewillett I reviewed all our free themes on WP.com and found these issues … |
There is a related issue happening in the editor. Reported on site with Independent Publisher 2 and also with Canard. Both are simple sites. Steps to reproduce
What I expect Image to remain center aligned in editor window and at new size What happened Image jumps to left aligned in editor, but if you preview the page or post, it will show correctly as center aligned. Independent Publisher 2 ticket: 2867721-zen |
This seems to have been fixed by WordPress/gutenberg#21167. I couldn't reproduce it with Baskerville 2 or Dara. Please feel free to re-open if this error re-appears or can be reliably reproduced. |
@obenland, it might be theme-related, but I can still replicate the one I reported here. With the Didi theme, create a new page using the "Front Template", the issue happens with a Vimeo or Youtube block, even though it has |
Yes, it looks to be a theme issue with that page template |
Thanks for checking, @obenland! I have reported on the theme's repo. 🙂 |
Steps to reproduce
What I expected
For the image to be center-aligned in the post
What happened instead
The image is left-aligned. Right-aligning the image works as expected, but selecting center-alignment causes the image to display left-aligned; or more accurate non-aligned as text from a succeeding paragraph block doesn't wrap as it does if the image is set to left-aligned.
Editing the post in the classic editor also indicates the image as non-aligned.
Screenshot / Video
Image in the editor:
Published post:
What I see if I edit the post in the classic editor in WP-Admin:
Viewing the block in HTML mode the
class="aligncenter
is applied to the image.I'm not able to replicate this on a self-hosted site, so it appears to be an issue specifically with WordPress.com.
Context / Source
User report in the support forums
The text was updated successfully, but these errors were encountered: