Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#53924 closed defect (bug) (fixed)

Press escape to close Attachment details on media upload page

Reported by: vondelphia's profile vondelphia Owned by: joedolson's profile joedolson
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit
Focuses: accessibility, javascript Cc:


How do we make it so I can press escape to close Attachment details modal / popup on the wordpress media page?

Just visit http://wordpress.test/wp-admin/upload.php and upload a file (in grid mode) and when you left click on it, pressing ESCAPE on keyboard does not close. I can click outside the box and it’ll work though.

p.s. can visit forum topic about it

Attachments (2)

53924.diff (533 bytes) - added by sourovroy 2 years ago.
This patch can fix the issue of close modal by Escape key.
53924.2.diff (615 bytes) - added by sourovroy 2 years ago.
Patch with update comment on the line above.

Download all attachments as: .zip

Change History (11)

#1 @sabernhardt
2 years ago

  • Component changed from General to Media
  • Focuses accessibility added

As noted on the support topic, the Escape key does work the first time you open the details modal dialog, but then pressing the key does not close the dialog when you open it again.

This issue seems familiar, yet I can't find a recent ticket about it (ticket:42180 fixed a different problem with the Escape key).

Last edited 2 years ago by sabernhardt (previous) (diff)

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.

2 years ago

#3 @joedolson
2 years ago

  • Keywords needs-patch added
  • Owner set to joedolson
  • Status changed from new to accepted

#4 @joedolson
2 years ago

  • Milestone changed from Awaiting Review to 5.9

#5 @joedolson
2 years ago

This seems like a pretty important issue; the experience should definitely be the same every time you open the dialog! I'm going to try and get this figured out for 5.9.

2 years ago

This patch can fix the issue of close modal by Escape key.

#6 @sourovroy
2 years ago

  • Keywords has-patch added; needs-patch removed

#7 @sabernhardt
2 years ago

  • Focuses javascript added

Thanks for the patch! With that, I was able to use the Escape key more than once.

We probably should edit the note above that line, too, because it does not remove restricted focus anymore. An earlier version of the script used a different method to keep focus inside the media modal, until r29220.

2 years ago

Patch with update comment on the line above.

#8 @joedolson
2 years ago

  • Keywords commit added

#9 @joedolson
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 51945:

Media: Close attachment details modal with esc key.

The event that fired closing the attachment details modal also removed the keydown event listener, so subsequent modals could not be closed with the escape key.

Props vondelphia, sourovroy, sabernhardt
Fixes #53924.

Note: See TracTickets for help on using tickets.