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

Gallery block: Empty space on front-end when an empty image block is added #39612

Closed
SiobhyB opened this issue Mar 21, 2022 · 4 comments
Closed
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@SiobhyB
Copy link
Contributor

SiobhyB commented Mar 21, 2022

Description

When an empty image block is added to a gallery and saved, it creates an empty space, both in the editor and on the site's front-end.

My expectation would be for empty image blocks to have no impact on the gallery's appearance on the front-end.

This was first brought up in wordpress-mobile/gutenberg-mobile#4317. It can be replicated in both the mobile app and on the web.

Step-by-step reproduction instructions

  1. Add a gallery block to the Gutenberg editor.
  2. Upload some images to the gallery.
  3. Select an image within the gallery and then select the block inserter (+) to add an empty image block.
  4. Save the post and preview the gallery.
  5. Verify that an empty space appears in the position where the empty image block was added.

Screenshots, screen recording, code snippet

The following is a recording of the steps to reproduce on the web:

Screen.Recording.2022-03-21.at.13.47.23.mov

The following video shows the steps to replicate the issue in the mobile app, including a preview of the site's front-end where the empty image placeholder can be viewed:

Gallery.mov

Environment info

Tested in both the latest version of the WordPress Android app and the latest version of Gutenberg running on a WordPress.com site.

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

@SiobhyB SiobhyB added [Type] Bug An existing feature does not function as intended [Block] Gallery Affects the Gallery Block - used to display groups of images labels Mar 21, 2022
@glendaviesnz
Copy link
Contributor

This is replicating the behaviour of the Image block, which also adds an empty figure and img tag to the frontend markup if no image is selected for the block - it is just more noticeable in the Gallery due to the grid layout:

empty-image.mp4

I wonder if we also want to remove the empty tags for the standalone Image block, or if there is a reason why these are left in the frontend markup?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 31, 2022
@NicoHood
Copy link

Is it possible to remove this extra box around the image? My usecase is a bit different, I want to have this visual space, but only for the large, not the mobile gallery. I want each row to have the same column size, but that seems currently not possible, isnt it?

@ramonjd
Copy link
Member

ramonjd commented Aug 30, 2022

What about adding the following in render_core_block_image?

Sorry, ignore my comment - only relevant to images in a gallery.

I just saw #39952

@t-hamano
Copy link
Contributor

t-hamano commented Dec 8, 2023

This issue cannot be reproduced with trunk and appears to be resolved by #45220 and #55269.

Image Block

Editor

There is an image block with no media set between two paragraphs.

editor

Frontend

Nothing is rendered between the paragraph blocks.

frontend

Gallery Block

Editor

Contains two image blocks with no media set.

editor-gallery

Frontend

Empty image blocks are not rendered and there are no empty columns.

frontend-gallery

I would like to close this issue, but please let us know if you are still experiencing issues.

@t-hamano t-hamano closed this as completed Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants