Make WordPress Core

Opened 17 months ago

Last modified 3 months ago

#45886 assigned defect (bug)

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

Reported by: statelessstudio Owned by: antpb
Milestone: Future Release Priority: normal
Severity: normal Version: 5.0.2
Component: Media Keywords: needs-patch
Focuses: javascript Cc:


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 17 months ago.
Source code to recreate issue

Download all attachments as: .zip

Change History (7)

17 months ago

Source code to recreate issue

#1 @joemcgill
14 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.

8 months ago

#3 @antpb
8 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.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

4 months ago

#5 @antpb
4 months ago

  • Owner set to antpb
  • Status changed from new to assigned

Setting myself as owner so that I can keep visibility into this issue as I work on tasks similar to this one. Will provide an update to let everyone know if this is possible in the 5.4 timeline. Thanks!

#6 @audrasjb
3 months ago

  • Milestone changed from 5.4 to Future Release


This ticket still needs a patch.

With 5.4 Beta 3 approaching and the Beta period reserved for bugs introduced during the cycle, this is being moved to Future Release. If any maintainer or committer feels this should be included or wishes to assume ownership during a specific cycle, feel free to update the milestone accordingly.

Note: See TracTickets for help on using tickets.