Make WordPress Core

Opened 5 weeks ago

Last modified 4 weeks ago

#61202 new defect (bug)

Gallery Block Columns Broken

Reported by: miqrogroove's profile miqrogroove Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

When creating a 2-column gallery in the block editor, the preview HTML looks like this:

<figure class="wp-block-gallery has-nested-images columns-2 is-cropped wp-block-gallery-1 is-layout-flex">

And unfortunately, the Twenty Fifteen stylesheets have no mention of columns-2 nor is-layout-flex.

I looked in twentytwentyone/style.css and couldn't find those class names listed there either.

Clearly, this can't work. Am I looking in the right place for the implementation?

One of the search results that came up dicussed implementing is-layout-flex which seems like a bad experience and non-implementation. https://wordpress.org/support/topic/gallery-not-displayed-in-columns/

First tested on v6.2.5 with a child theme of Twenty Fifteen v3.7.

Change History (6)

#1 @miqrogroove
5 weeks ago

I found part of the code that makes the editor work under wp-includes/blocks/gallery/style.css

It looks like this...

.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){
  margin:0;
  width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)/2);
}
@media (min-width:600px){
  .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image){
    width:calc(33.33333% - var(--wp--style--unstable-gallery-gap, 16px)*.66667);
  }

#2 @miqrogroove
5 weeks ago

After some aimless searches on Google, I'm wondering if it's because themes prior to Twenty Twenty-Two aren't tagged full-site-editing. If that's the case, this is rather hard to understand. Nothing in the Visual Editor ever mentioned that the gallery block styles might be incompatible with the current theme.

After activating the Twenty Twenty-Two theme, the problem went away.

Last edited 5 weeks ago by miqrogroove (previous) (diff)

This ticket was mentioned in Slack in #core-test by ankit-k-gupta. View the logs.


5 weeks ago

#4 @poena
4 weeks ago

Hi @miqrogroove

Can you share any more information about in what way the gallery is broken,
and step by step instructions on how to reproduce the problem?

I am not sure I understand what you mean with "the preview HTML".

I did the following:

  • Activated Twenty Fifteen.
  • Created a new post.
  • Inserted a new gallery block with 8 images.
  • Changed the column setting to 2 columns.

I am using WordPress 6.3.5 without any plugins active.

I do not see any visual problems in the editor or the front.
So I am not sure what is breaking for you.


The older bundled themes like Twenty Fifteen, they do have problems with some of the new block settings, usually because of conflicting CSS, but I did not find any related reports.

#5 @poena
4 weeks ago

  • Keywords reporter-feedback added

#6 @miqrogroove
4 weeks ago

I haven't tested v6.3.5 so not sure if that would be significant. I already updated the site that was having the gallery problems. If I have time to reproduce the problem I will follow up.

Note: See TracTickets for help on using tickets.