Index: src/wp-admin/js/inline-edit-post.js
===================================================================
--- src/wp-admin/js/inline-edit-post.js (revision 36297)
+++ src/wp-admin/js/inline-edit-post.js (working copy)
@@ -1,4 +1,5 @@
/* global inlineEditL10n, ajaxurl, typenow */
+window.wp = window.wp || {};
var inlineEditPost;
(function($) {
@@ -62,7 +63,11 @@
$('select[name="_status"] option[value="future"]', bulkRow).remove();
$('#doaction, #doaction2').click(function(e){
- var n = $(this).attr('id').substr(2);
+ var n;
+
+ t.whichBulkButtonId = $( this ).attr( 'id' );
+ n = t.whichBulkButtonId.substr( 2 );
+
if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
e.preventDefault();
t.setBulk();
@@ -244,6 +249,7 @@
return false;
},
+ // Ajax saving is only for Quick Edit.
save : function(id) {
var params, fields, page = $('.post_status_page').val() || '';
@@ -267,6 +273,8 @@
// make ajax request
$.post( ajaxurl, params,
function(r) {
+ var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
+
$( 'table.widefat .spinner' ).removeClass( 'is-active' );
$( '.ac_results' ).hide();
@@ -274,13 +282,19 @@
if ( -1 !== r.indexOf( '
]*?>/g, '' );
- $('#edit-'+id+' .inline-edit-save .error').html(r).show();
+ $errorSpan.html( r ).show();
+ wp.a11y.speak( $errorSpan.text() );
}
} else {
- $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
+ $errorSpan.html( inlineEditL10n.error ).show();
+ wp.a11y.speak( inlineEditL10n.error );
}
},
'html');
@@ -288,6 +302,7 @@
return false;
},
+ // Revert is for both Quick Edit and Bulk Edit.
revert : function(){
var $tableWideFat = $( '.widefat' ),
id = $( '.inline-editor', $tableWideFat ).attr( 'id' );
@@ -300,10 +315,13 @@
$( '#bulk-edit', $tableWideFat ).removeClass( 'inline-editor' ).hide().siblings( '.hidden' ).remove();
$('#bulk-titles').empty();
$('#inlineedit').append( $('#bulk-edit') );
+ // Move focus back to the Bulk Action button that was activated.
+ $( '#' + inlineEditPost.whichBulkButtonId ).focus();
} else {
$('#'+id).siblings('tr.hidden').addBack().remove();
id = id.substr( id.lastIndexOf('-') + 1 );
- $(this.what+id).show();
+ // Show the post row and move focus back to the Quick Edit link.
+ $( this.what + id ).show().find( '.editinline' ).focus();
}
}
@@ -362,4 +380,4 @@
}
});
-}(jQuery));
+})( jQuery, window.wp );
Index: src/wp-includes/script-loader.php
===================================================================
--- src/wp-includes/script-loader.php (revision 36297)
+++ src/wp-includes/script-loader.php (working copy)
@@ -560,12 +560,13 @@
$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
- $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
+ $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest', 'wp-a11y' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
- 'error' => __('Error while saving the changes.'),
- 'ntdeltitle' => __('Remove From Bulk Edit'),
- 'notitle' => __('(no title)'),
- 'comma' => trim( _x( ',', 'tag delimiter' ) ),
+ 'error' => __( 'Error while saving the changes.' ),
+ 'ntdeltitle' => __( 'Remove From Bulk Edit' ),
+ 'notitle' => __( '(no title)' ),
+ 'comma' => trim( _x( ',', 'tag delimiter' ) ),
+ 'saved' => __( 'Changes saved.' ),
) );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );