WordPress.org

Make WordPress Core

Opened 22 months ago

Closed 9 months ago

#43139 closed defect (bug) (fixed)

Gallery widget preview incorrectly updated after one image gets deleted

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

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 22 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 21 months ago.

Download all attachments as: .zip

Change History (8)

@janak007
22 months ago

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

#1 @janak007
22 months ago

  • Keywords has-patch needs-testing added

#2 @westonruter
21 months ago

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

#3 @westonruter
21 months ago

  • Milestone changed from Awaiting Review to 5.0

#4 @mrasharirfan
13 months ago

Hi,

I just tested the issue by following the instructions in the description of the ticket and regenerated the bug.

Related screenshot:

https://i.imgur.com/y2hnEut.jpg

After that, I applied the fix for testing. Then tried to reproduce the issue again and the bug was gone.

Related screenshot:

https://i.imgur.com/3gyCJVh.jpg

Hope this helps!

Peace ✌️

#5 @pento
13 months ago

  • Milestone changed from 5.0 to 5.1

#6 @pento
9 months ago

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

In 44661:

Widgets: Fix Gallery Widget preview after an image is deleted.

The Gallery Widget incorrectly tried to include the deleted image in the preview.

Props westonruter, janak007, afercia, mrasharirfan.
Fixes #43139.

Note: See TracTickets for help on using tickets.