Make WordPress Core

Opened 12 months ago

Last modified 4 months ago

#45886 new defect (bug)

Media modal .edit-attachment link opens in new tab rather than in modal

Reported by: statelessstudio Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version: 5.0.2
Component: Media Keywords: needs-patch
Focuses: javascript Cc:
PR Number:


Using the wp.media JavaScript API creates a link "Edit Image" (.edit-attachment) in the right sidebar of the Media modal. Expected behavior would be to open the "Edit Image" modal, as does the Featured Image media modal.

However, the custom Media modal does not behave consistently with the Featured Image modal - the .edit-attachment link opens in a new tab instead of the modal - which is both unintuitive and frustrating to end-users.

The console does not display any warnings or errors.

Custom media modal as documented: https://codex.wordpress.org/Javascript_Reference/wp.media

As a side note, I have noticed similar behavior in the WordPress Media page:

Media (Admin Sidebar) -> Click a picture -> Edit more Details

This also fails to open the modal - and opens in the current page instead.

Attachments (1)

media.php.zip (1.8 KB) - added by statelessstudio 12 months ago.
Source code to recreate issue

Download all attachments as: .zip

Change History (4)

12 months ago

Source code to recreate issue

#1 @joemcgill
9 months ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.3

Hi @statelessstudio,

I can confirm that I am able to reproduce this behavior, but it seems to happen even in the featured image panel of the new block editor. I've not noticed this before, so I'm wondering if this is a regression in one of the last few releases. I'm going to add this to the next release milestone to investigate.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.

4 months ago

#3 @antpb
4 months ago

  • Milestone changed from 5.3 to 5.4

It's looking a little late in the 5.3 release cycle to tackle this. I think we should move this to 5.4. Still a bit of investigation needed here.

Note: See TracTickets for help on using tickets.