Automattic / themes

Free WordPress themes made by Automattic for WordPress.org and WordPress.com.
https://themeshaper.com
GNU General Public License v2.0
891 stars 355 forks source link

Most themes: Gutenberg: Image caption styling not applied with Block Editor #1673

Closed formosattic closed 2 years ago

formosattic commented 5 years ago

Edit by @arunsathiya: As discussed here p1574159858171000-slack-triage, I am moving the issue from Calypso repository to themes repository. This issue is reproducible with a lot of themes on https://wordpress.com/themes. @thehenrybyrd has a particular helpful comment https://github.com/Automattic/themes/issues/1673#issuecomment-555453912


Steps to reproduce

Create two posts with an image with caption, one post with the Block Editor, and the other with the Classic Editor.

What I expected

Caption should display the same styling from the theme, regardless of the editor used.

What happened instead

Tested with different themes (Twenty Nineteen, Karuna, Libretto).

The Classic Editor, will apply the theme styling:

screen shot 2019-01-02 at 12 31 11

The Block Editor applies a different styling:

screen shot 2019-01-02 at 12 31 44

Context / Source

Ticket: 1678324-zen

arunsathiya commented 5 years ago

Noting that I am able to reproduce this as well. I tested with Libretto theme and Twenty Nineteen.

Libretto:

Composed using the WordPress Editor

screenshot 2019-01-02 at 11 48 15 screenshot 2019-01-02 at 11 51 08

Composed using the Calypso editor

screenshot 2019-01-02 at 11 48 25 screenshot 2019-01-02 at 11 50 49

Twenty Nineteen:

There is not much difference between how it looks on Twenty Nineteen, but the caption text color seems to be different when composed using WordPress Editor and Calypso editor.

Composed using the WordPress Editor

screenshot 2019-01-02 at 12 03 39

screen shot 2019-01-02 at 12 04 04

Composed using the Calypso editor

screenshot 2019-01-02 at 12 03 33 screen shot 2019-01-02 at 12 06 06
gwwar commented 5 years ago

@arunsathiya if you recall was this the same result on both wp-admin and Gutenlypso?

gwwar commented 5 years ago

cc'ing @laurelfulford in case this is related to other CSS specificity from gutenberg vs theme rules.

laurelfulford commented 5 years ago

At a glance this all looks theme-related to me. In Libretto's case, for the initial report, it looks like we may have missed styling the captions in some cases.

In the classic vs block editor for Libretto, the markup is different for things like an image with a caption vs an image block with a caption, so adding things like the white background to the image block wasn't possible. So that's not exactly a bug, but an unfortunate side effect of updating a theme that already had styles for the classic editor that we couldn't recreate in the block :)

Not sure of the cause of the slightly different colours for Twenty Nineteen, but that would be coming from the theme, too.

arunsathiya commented 5 years ago

Just tested again. To quickly followup on this, the Calypsoified Gutenberg and Gutenlypso output seems to be the same, while Calypso editor-composed output is different.

gwwar commented 5 years ago

I believe this looks correct now? Please reopen, if folks are still seeing this!

KokkieH commented 5 years ago

We've had a report of this in https://en.forums.wordpress.com/topic/image-captions-style-not-showing-correctly/

@laurelfulford would it be best to open issues for individual themes as this come up so styling for block captions can be added in the themes, or is this something we're unlikely to fix?

Edited to add: The user in this case is using the Plane theme.

chiape commented 5 years ago

I was able to replicate the figcaption issue on a test site:

Themes: Tortuga & Hemingway Rewritten

Screen Shot 2019-10-03 at 17 03 27 Screen Shot 2019-10-03 at 17 03 54

carinapilar commented 5 years ago

Reported on 15846870-hc with the Adaline theme. Fixed with a CSS workaround.

thehenrybyrd commented 4 years ago

Ran into this in 16756564-hc. The user is using the Photo Blog theme, and the CSS classes missing are: wp-caption-text and gallery-caption (though wp-caption-text is the important one) We worked around the issue by adding wp-caption-text and gallery-caption in the "Additional CSS classes" box in advanced block settings for each block where the user wanted a caption.

However, I did some more testing to try to figure out what was up and found that the same CSS classes are not appearing in posts created in Gutenberg in a lot of our themes. In particular I looked at Titan, Edin, Chalkboard, Anemone, Lovecraft, Goran, Able, and Independent Publisher. All of these themes miss caption styling when posts are created in Gutenberg, and adding the CSS class wp-caption-text fixes the captions in all of them.

I got the same result with Edin on a jurassic.ninja site.

As an example, here’s how caption text should look in Edin:

caption

Here’s how caption text looks in Edin if you create a new post using Gutenberg:

Here's a caption

The same is happening with many of our themes.

kaitohm commented 4 years ago

Another report: 23976514-hc As user is on Personal plan, CSS workaround won't work.

tbradsha commented 3 years ago

3653977-zen, using Hemingway Rewritten.

Provided a simple CSS workaround:

figure figcaption {
  text-align: center;
}
kisabelle commented 3 years ago

I'm noticing today that on the Gutenberg editor the Gallery block caption appears to receive completely different styles than on the front end.

Gutenberg editor:

Screen Shot 2021-03-01 at 9 27 56 AM

Screen Shot 2021-03-01 at 9 27 02 AM

Front-end styles:

Screen Shot 2021-03-01 at 9 28 22 AM

Screen Shot 2021-03-01 at 9 26 51 AM

Some consistency here would be much appreciated.

KokkieH commented 2 years ago

Another report for Hemingway Rewritten in https://wordpress.com/forums/topic/image-caption-not-aligning-center/?view=all

Robertght commented 2 years ago

I'm no longer able to replicate this issue with the themes mentioned as we have styling options for the captions:

image

image

I'm going to close this one for now, but please open it in case it needs more work.