diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/js/inline-edit-post.js --- a/wp/wp-admin/js/inline-edit-post.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/js/inline-edit-post.js Tue Sep 27 16:37:53 2022 +0200 @@ -131,7 +131,7 @@ $('#bulk-edit').find('fieldset:first').after( $('#inline-edit fieldset.inline-edit-categories').clone() ).siblings( 'fieldset:last' ).prepend( - $('#inline-edit label.inline-edit-tags').clone() + $( '#inline-edit .inline-edit-tags-wrap' ).clone() ); $('select[name="_status"] option[value="future"]', bulkRow).remove(); @@ -197,9 +197,15 @@ // If the checkbox for a post is selected, add the post to the edit list. if ( $(this).prop('checked') ) { c = false; - var id = $(this).val(), theTitle; - theTitle = $('#inline_'+id+' .post_title').html() || wp.i18n.__( '(no title)' ); - te += '
X'+theTitle+'
'; + var id = $( this ).val(), + theTitle = $( '#inline_' + id + ' .post_title' ).html() || wp.i18n.__( '(no title)' ), + buttonVisuallyHiddenText = wp.i18n.sprintf( + /* translators: %s: Post title. */ + wp.i18n.__( 'Remove “%s” from Bulk Edit' ), + theTitle + ); + + te += '
  • '; } }); @@ -208,18 +214,34 @@ return this.revert(); } - // Add onclick events to the delete-icons in the bulk editors the post title list. - $('#bulk-titles').html(te); + // Populate the list of items to bulk edit. + $( '#bulk-titles' ).html( '' ); + /** - * Binds on click events to the checkboxes before the posts in the table. + * Binds on click events to handle the list of items to bulk edit. * * @listens click */ - $('#bulk-titles a').on( 'click', function(){ - var id = $(this).attr('id').substr(1); + $( '#bulk-titles .ntdelbutton' ).click( function() { + var $this = $( this ), + id = $this.attr( 'id' ).substr( 1 ), + $prev = $this.parent().prev().children( '.ntdelbutton' ), + $next = $this.parent().next().children( '.ntdelbutton' ); + + $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false ); + $( '#_' + id ).parent().remove(); + wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' ); - $('table.widefat input[value="' + id + '"]').prop('checked', false); - $('#ttle'+id).remove(); + // Move focus to a proper place when items are removed. + if ( $next.length ) { + $next.focus(); + } else if ( $prev.length ) { + $prev.focus(); + } else { + $( '#bulk-titles-list' ).remove(); + inlineEditPost.revert(); + wp.a11y.speak( wp.i18n.__( 'All selected items have been removed. Select new items to use Bulk Actions.' ) ); + } }); // Enable auto-complete for tags when editing posts. @@ -238,6 +260,8 @@ } ); } + // Set initial focus on the Bulk Edit region. + $( '#bulk-edit .inline-edit-wrapper' ).attr( 'tabindex', '-1' ).focus(); // Scrolls to the top of the table where the editor is rendered. $('html, body').animate( { scrollTop: 0 }, 'fast' ); }, @@ -270,6 +294,10 @@ editRow = $('#inline-edit').clone(true); $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length ); + // Remove the ID from the copied row and let the `for` attribute reference the hidden ID. + $( 'td', editRow ).find('#quick-edit-legend').removeAttr('id'); + $( 'td', editRow ).find('p[id^="quick-edit-"]').removeAttr('id'); + $(t.what+id).removeClass('is-expanded').hide().after(editRow).after(''); // Populate fields in the quick edit window.