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

Editing a gallery shows all images from the media library as selected #9072

florianbrinkmann opened this issue Aug 17, 2018 · 6 comments


Copy link

@florianbrinkmann florianbrinkmann commented Aug 17, 2018

Describe the bug

After creating a gallery block and uploading an image to it – via drag & drop or the upload button – all images of the media library are displayed as selected in the edit gallery view. I am using Gutenberg 3.5.

To Reproduce
Steps to reproduce the behavior:

  1. Insert a gallery block.
  2. Upload one or more images to it via drag & drop or the upload button.
  3. Click the Edit Gallery button
  4. See all images of the library as selected.

Expected behavior

Just the images from the gallery should be set as selected.



Desktop (please complete the following information):

  • Windows 10
  • Firefox Nightly
  • 63.0a1 (2018-08-16)
Copy link

@designsimply designsimply commented Aug 17, 2018

Good find! Tested and confirmed with WordPress 4.9.8 and Gutenberg 3.6.2 using Firefox 61.0.2 and Chrome 68.0.3440.106 on macOS 10.13.6. (1m29s)


@designsimply designsimply added this to the 3.7 milestone Aug 20, 2018
@youknowriad youknowriad removed this from the 3.7 milestone Aug 30, 2018
@youknowriad youknowriad added this to the 3.8 milestone Aug 30, 2018
@youknowriad youknowriad removed this from the 3.8 milestone Sep 5, 2018
Copy link

@jeherve jeherve commented Jan 10, 2019

This is still happening today. I was able to reproduce this just now. 👍

Copy link

@paaljoachim paaljoachim commented Jan 21, 2019

Just yesterday I was also able to reproduce the same issue.

Btw I received some feedback in the Slack #design channel:
"There was a discussion in my local meetup channel about galleries and a friend created this video to illustrated the challenges he was having using the gallery block."

Copy link

@paaljoachim paaljoachim commented Feb 6, 2019

Btw - An update for GB version 5.0 Rc-1

Uploading media: Still having the same gallery block selected click the pencil icon. All the images in the media library shows up. I clicked cancel. Deselected the gallery block and then selected it again. Then only 4 images showed up in the Edit Gallery view.

Copy link

@antpb antpb commented Feb 22, 2019

I started digging into this. Wanted to document some of my initial findings as I find a solution.
I'm noticing we check for images.length to render the edit toolbar. Then we set the value of the edit button to ( img ) => )

{ !! images.length && (
onSelect={ this.onSelectImages }
allowedTypes={ ALLOWED_MEDIA_TYPES }
value={ ( img ) => ) }
render={ ( { open } ) => (
label={ __( 'Edit gallery' ) }
onClick={ open }
) }
) }

The images object updates as each photo dropped is uploaded. I'm thinking that the initial value is mapping through an empty images attribute and is holding that value. To test this I added a log right after the condition. You'll notice that the object starts as a blank array, then starts filling in the ids as they upload. I think that when the array is initially set, it passes the images.length check and assigns the value field to a blank array. For whatever reason, the value field of the MediaUpload component is not updating with the updates to the images attribute. Going to continue investigating. :)

screen shot 2019-02-22 at 11 35 24 am

Copy link

@youknowriad youknowriad commented Oct 29, 2019

this is invalid now as that button has been removed;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants