[wp-trac] [WordPress Trac] #38142: Media modal: handle keyboard focus when closing the modal
WordPress Trac
noreply at wordpress.org
Fri Sep 23 13:54:11 UTC 2016
#38142: Media modal: handle keyboard focus when closing the modal
---------------------------------------+-----------------------------
Reporter: afercia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Keywords: needs-patch
Focuses: accessibility, javascript |
---------------------------------------+-----------------------------
When the media modal closes, it tries to set focus back to a "useful
location" and [https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/js/media/views/modal.js?rev=33337#L144 assumes there's an element
with id 'wpbody-content'], i.e. the admin pages main content.
This is not always true, for example there's no `wpbody-content` element:
- in the Customizer
- in Press This
- when the media modal is used on the front end
- plugins may provide completely customised pages that don't have `wpbody-
content`
This is very evident in the Customizer, for example when setting a
Background Image and using the keyboard :
- press "Select Image"
- the media modal opens
- press Escape to close the modal
- focus is lost and the tab order starts again from the document root (or
the browser's toolbar)
Ideally, when the media modal opens it should store a reference to the
element that was clicked to open it and then when the modal closes, focus
should be restored on this element.
The only exception is TinyMCE: when an imag eis actually inserted in the
editable area, focus should go in the editable area. As far as I see
TinyMCE already takes care of this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38142>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list