Skip to content

MediaUpload gallery + allowedTypes attributes do not work as documented in combination #53619

@thenadz

Description

@thenadz

Description

The MediaUpload component gallery and allowedTypes attributes do not function as documented when used in combination. If gallery is used, effective allowedTypes appears to always be image.

This forces major development efforts to replicate the same functionality where other file types are in play, as with Document Gallery for example.

Step-by-step reproduction instructions

  1. Create MediaUpload element with below configuration and non-image files available. Confirm that the available files in dialog are exclusively images.
<MediaUpload
  gallery={true}
  allowedTypes='application,video,text,audio,image'
  render={({open}) => (
	  <Button
		  variant='secondary'
		  onClick={open}
	  >
		  Select files
	  </Button>
  )}
  />
  1. Create MediaUpload element with below configuration and non-image files available. Confirm that all files are displayed in dialog.
<MediaUpload
  allowedTypes='application,video,text,audio,image'
  render={({open}) => (
	  <Button
		  variant='secondary'
		  onClick={open}
	  >
		  Select files
	  </Button>
  )}
  />

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress Version: 6.2
  • Browser: Chrome
  • Platform: Windows 10

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DevReady for, and needs developer efforts[Feature] MediaAnything that impacts the experience of managing media[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions