--- a/wp/wp-admin/js/inline-edit-tax.js Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/js/inline-edit-tax.js Mon Oct 14 18:28:13 2019 +0200
@@ -1,8 +1,11 @@
-/* global inlineEditL10n, ajaxurl */
/**
* This file is used on the term overview page to power quick-editing terms.
+ *
+ * @output wp-admin/js/inline-edit-tax.js
*/
+/* global inlineEditL10n, ajaxurl, inlineEditTax */
+
window.wp = window.wp || {};
/**
@@ -14,16 +17,13 @@
* @property {string} what The type property with a hash prefixed and a dash
* suffixed.
*/
-var inlineEditTax;
-
( function( $, wp ) {
-inlineEditTax = {
+window.inlineEditTax = {
/**
- * @summary Initializes the inline taxonomy editor.
- *
- * Adds event handlers to be able to quick edit.
+ * Initializes the inline taxonomy editor by adding event handlers to be able to
+ * quick edit.
*
* @since 2.7.0
*
@@ -37,13 +37,13 @@
t.type = $('#the-list').attr('data-wp-lists').substr(5);
t.what = '#'+t.type+'-';
- $('#the-list').on('click', 'a.editinline', function(){
- inlineEditTax.edit(this);
- return false;
+ $( '#the-list' ).on( 'click', '.editinline', function() {
+ $( this ).attr( 'aria-expanded', 'true' );
+ inlineEditTax.edit( this );
});
- /*
- * @summary Cancels inline editing when pressing escape inside the inline editor.
+ /**
+ * Cancels inline editing when pressing escape inside the inline editor.
*
* @param {Object} e The keyup event that has been triggered.
*/
@@ -55,21 +55,21 @@
});
/**
- * @summary Cancels inline editing when clicking the cancel button.
+ * Cancels inline editing when clicking the cancel button.
*/
$( '.cancel', row ).click( function() {
return inlineEditTax.revert();
});
/**
- * @summary Saves the inline edits when clicking the save button.
+ * Saves the inline edits when clicking the save button.
*/
$( '.save', row ).click( function() {
return inlineEditTax.save(this);
});
/**
- * @summary Saves the inline edits when pressing enter inside the inline editor.
+ * Saves the inline edits when pressing enter inside the inline editor.
*/
$( 'input, select', row ).keydown( function( e ) {
// 13 = [enter]
@@ -79,7 +79,7 @@
});
/**
- * @summary Saves the inline edits on submitting the inline edit form.
+ * Saves the inline edits on submitting the inline edit form.
*/
$( '#posts-filter input[type="submit"]' ).mousedown( function() {
t.revert();
@@ -149,7 +149,7 @@
},
/**
- * @summary Saves the quick edit data.
+ * Saves the quick edit data.
*
* Saves the quick edit data to the server and replaces the table row with the
* HTML retrieved from the server.
@@ -187,7 +187,7 @@
// Do the ajax request to save the data to the server.
$.post( ajaxurl, params,
/**
- * @summary Handles the response from the server.
+ * Handles the response from the server
*
* Handles the response from the server, replaces the table row with the response
* from the server.
@@ -220,8 +220,10 @@
$( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );
row.hide().fadeIn( 400, function() {
- // Move focus back to the Quick Edit link.
- row.find( '.editinline' ).focus();
+ // Move focus back to the Quick Edit button.
+ row.find( '.editinline' )
+ .attr( 'aria-expanded', 'false' )
+ .focus();
wp.a11y.speak( inlineEditL10n.saved );
});
@@ -263,8 +265,10 @@
$('#'+id).siblings('tr.hidden').addBack().remove();
id = id.substr( id.lastIndexOf('-') + 1 );
- // Show the taxonomy row and move focus back to the Quick Edit link.
- $( this.what + id ).show().find( '.editinline' ).focus();
+ // Show the taxonomy row and move focus back to the Quick Edit button.
+ $( this.what + id ).show().find( '.editinline' )
+ .attr( 'aria-expanded', 'false' )
+ .focus();
}
},