WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 6 months ago

#52789 closed defect (bug) (fixed)

Gallery layout block adds all media items when changing an image

Reported by: MikeLittle Owned by:
Milestone: 5.7.1 Priority: normal
Severity: normal Version: 5.7
Component: Editor Keywords: needs-patch
Focuses: Cc:

Description

## Steps to reproduce:

  1. Have multiple items already added to the media library.
  2. Create a new post
  3. Drag a the Gallery pattern (two images side by side)
  4. Select one image
  5. Click media library
  6. Select ONE image
  7. Click Add to gallery
  8. All images are selected
  9. Click update gallery
  10. All images are added to the gallery

## Expected behaviour
Only one image is added to the gallery

I'm not sure whether the bug is in the block or the media library. There were no errors or warnings in the JS Console

Running WordPress under 'wplocal' (flywheel/wpengine).
PHP 7.4.1
Browser: Chrome 88.0.4324.192

Video demo of the issue: https://vimeo.com/522746498/0ca3c5a137

Change History (8)

#1 @desrosj
7 months ago

  • Component changed from General to Editor
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.7.1

Good catch on this one!

I did some testing, and looks like this is reproducible in trunk as well. However, it only happens if the original two images are in the gallery. For example, if you replace one of the images and then click Media Library as seen in the video, the issue does not occur.

My hunch is that it has something to do with both IDs being null in the block definition (<!-- wp:gallery {"ids":[null,null],"linkTo":"none","align":"wide"} --> is what gets inserted).

Some other things I noticed:

  • If you replace one of the default images and then add to the gallery, it only shows two images in the media modal when there are actually three.
  • After clicking on an image in the gallery and clicking the edit pencil in the top right, the buttons and links within the highlighted area cannot be selected.

This will probably need an issue over on GitHub, but leaving this open for now for visibility.

Last edited 7 months ago by desrosj (previous) (diff)

This ticket was mentioned in Slack in #core-editor by desrosj. View the logs.


7 months ago

#3 @desrosj
7 months ago

I've created https://github.com/WordPress/gutenberg/issues/29835 and https://github.com/WordPress/gutenberg/issues/29834 upstream for these issues. Going to leave this open for now for tracking purposes.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by mamaduka. View the logs.


6 months ago

#8 @peterwilsoncc
6 months ago

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed in the package updated committed in [50678] for ticket #52912.

Note: See TracTickets for help on using tickets.