Media Grid/Modal Keyboard navigation improvements:

* Add focus to arrows on Next/Previous in the grid's modal on left/right keypress, and add the necessary CSS for `:focus`
* When in a disabled input in the grid modal, allow the left/right keys to work
* Make the image editor return a `$.Deferred` so that there isn't a race condition with UI loading. 
* Assign focus when the edit image mode is rendered so that the modal can be closed on Esc press

Props wonderboymusic, adamsilverstein (for the initial patch).
See #23560.

Built from https://develop.svn.wordpress.org/trunk@29560


git-svn-id: http://core.svn.wordpress.org/trunk@29335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2014-08-21 02:35:17 +00:00
parent 53c047263b
commit 6352d703a0
10 changed files with 55 additions and 34 deletions

View File

@@ -302,7 +302,7 @@ var imageEdit = window.imageEdit = {
open : function( postid, nonce, view ) {
this._view = view;
var data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid),
var dfd, data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid),
btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('.spinner');
btn.prop('disabled', true);
@@ -315,13 +315,20 @@ var imageEdit = window.imageEdit = {
'do': 'open'
};
elem.load(ajaxurl, data, function() {
dfd = $.ajax({
url: ajaxurl,
type: 'post',
data: data
}).done(function( html ) {
elem.html( html );
head.fadeOut('fast', function(){
elem.fadeIn('fast');
btn.removeAttr('disabled');
spin.hide();
});
});
return dfd;
},
imgLoaded : function(postid) {

File diff suppressed because one or more lines are too long