Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#53924 closed defect (bug) (fixed)

Press escape to close Attachment details on media upload page

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

Description

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 https://wordpress.org/support/topic/press-escape-to-close-attachment-details-on-media-upload-page/

Attachments (2)

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

Download all attachments as: .zip

Change History (11)

#1 @sabernhardt
5 years ago

  • Component GeneralMedia
  • 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 5 years ago by sabernhardt (previous) (diff)

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


5 years ago

#3 @joedolson
5 years ago

  • Keywords needs-patch added
  • Owner set to joedolson
  • Status newaccepted

#4 @joedolson
5 years ago

  • Milestone Awaiting Review5.9

#5 @joedolson
5 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.

@sourovroy
5 years ago

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

#6 @sourovroy
5 years ago

  • Keywords has-patch added; needs-patch removed

#7 @sabernhardt
5 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.

@sourovroy
5 years ago

Patch with update comment on the line above.

#8 @joedolson
5 years ago

  • Keywords commit added

#9 @joedolson
5 years ago

  • Resolutionfixed
  • Status acceptedclosed

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.