WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 3 months ago

#43139 new defect (bug)

Gallery widget preview incorrectly updated after one image gets deleted

Reported by: afercia Owned by:
Milestone: 5.1 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 12 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 11 months ago.

Download all attachments as: .zip

Change History (7)

@janak007
12 months ago

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

#1 @janak007
12 months ago

  • Keywords has-patch needs-testing added

#2 @westonruter
11 months ago

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

#3 @westonruter
11 months ago

  • Milestone changed from Awaiting Review to 5.0

#4 @mrasharirfan
3 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
3 months ago

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