WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 4 months ago

#43139 new defect (bug)

Gallery widget preview incorrectly updated after one image gets deleted

Reported by: afercia Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: 4.9
Component: Widgets Keywords: has-screenshots has-patch needs-testing
Focuses: javascript Cc:

Description

To reproduce:

  • go in the widgets screen
  • create a gallery widget with 7 images and save
  • the preview displays 6 images, the last image has an overlay with text "+2"

https://cldup.com/mbKHvWdzjI.jpg

  • go in the media library
  • delete one of the images used for the gallery
  • go back in the widgets screen and open the gallery widget to see the preview
  • the preview displays 5 images, the last image has an overlay with text "+2"

https://cldup.com/8e2LlQpa5f.jpg

Since there's room available for the 6th image, the image should be displayed and the overlay with text "+2" shouldn't be there. Same happens in the Customizer.

Note: Clicking "Edit Gallery" to make the media modal open and then clicking "Update gallery" rebuilds the preview "fixing" the issue.

Attachments (2)

43139.patch (872 bytes) - added by janak007 5 months ago.
I have added a patch to fix this issue. I have eliminated media item id which is causing issue.
43139.2.diff (1.6 KB) - added by westonruter 4 months ago.

Download all attachments as: .zip

Change History (5)

@janak007
5 months ago

I have added a patch to fix this issue. I have eliminated media item id which is causing issue.

#1 @janak007
5 months ago

  • Keywords has-patch needs-testing added

@westonruter
4 months ago

#2 @westonruter
4 months ago

It would be better to use _.filter. See 43139.2.diff for an untested patch.

#3 @westonruter
4 months ago

  • Milestone changed from Awaiting Review to 5.0
Note: See TracTickets for help on using tickets.