diff --git a/package.json b/package.json
index f84e4eb040..f0ca3fcd6e 100644
|
a
|
b
|
|
| 186 | 186 | "env:cli": "node ./tools/local-env/scripts/docker.js exec --user wp_php cli wp", |
| 187 | 187 | "env:logs": "node ./tools/local-env/scripts/docker.js logs", |
| 188 | 188 | "env:pull": "node ./tools/local-env/scripts/docker.js pull", |
| | 189 | "env:composer": "node ./tools/local-env/scripts/docker.js run -T --rm php composer", |
| 189 | 190 | "test:performance": "wp-scripts test-playwright --config tests/performance/playwright.config.js", |
| 190 | 191 | "test:php": "node ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpunit", |
| 191 | 192 | "test:coverage": "npm run test:php -- --coverage-html ./coverage/html/ --coverage-php ./coverage/php/report.php --coverage-text=./coverage/text/report.txt", |
diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js
index 3b6cf2b489..ff7761adb8 100644
|
a
|
b
|
jQuery( function($) { |
| 31 | 31 | if ( r ) { |
| 32 | 32 | data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag'); |
| 33 | 33 | |
| | 34 | tr.children().css('backgroundColor', '#faafaa'); |
| | 35 | |
| | 36 | // Disable pointer events and all form controls/links in the row |
| | 37 | tr.css('pointer-events', 'none'); |
| | 38 | tr.find(':input, a').prop('disabled', true).attr('tabindex', -1); |
| | 39 | |
| 34 | 40 | /** |
| 35 | 41 | * Makes a request to the server to delete the term that corresponds to the |
| 36 | 42 | * delete term button. |
| … |
… |
jQuery( function($) { |
| 40 | 46 | * @return {void} |
| 41 | 47 | */ |
| 42 | 48 | $.post(ajaxurl, data, function(r){ |
| | 49 | var message; |
| 43 | 50 | if ( '1' == r ) { |
| 44 | 51 | $('#ajax-response').empty(); |
| | 52 | let nextFocus = tr.next( 'tr' ).find( 'a.row-title' ); |
| | 53 | let prevFocus = tr.prev( 'tr' ).find( 'a.row-title' ); |
| | 54 | // If there is neither a next row or a previous row, focus the tag input field. |
| | 55 | if ( nextFocus.length < 1 && prevFocus.length < 1 ) { |
| | 56 | nextFocus = $( '#tag-name' ).trigger( 'focus' ); |
| | 57 | } else { |
| | 58 | if ( nextFocus.length < 1 ) { |
| | 59 | nextFocus = prevFocus; |
| | 60 | } |
| | 61 | } |
| | 62 | |
| 45 | 63 | tr.fadeOut('normal', function(){ tr.remove(); }); |
| 46 | 64 | |
| 47 | 65 | /** |
| … |
… |
jQuery( function($) { |
| 53 | 71 | */ |
| 54 | 72 | $('select#parent option[value="' + data.match(/tag_ID=(\d+)/)[1] + '"]').remove(); |
| 55 | 73 | $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove(); |
| 56 | | |
| | 74 | nextFocus.trigger( 'focus' ); |
| | 75 | message = wp.i18n.__( 'The selected tag has been deleted.' ); |
| | 76 | |
| 57 | 77 | } else if ( '-1' == r ) { |
| 58 | | $('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '</p></div>'); |
| 59 | | tr.children().css('backgroundColor', ''); |
| | 78 | message = wp.i18n.__( 'Sorry, you are not allowed to do that.' ); |
| | 79 | $('#ajax-response').empty().append('<div class="notice notice-error"><p>' + message + '</p></div>'); |
| | 80 | resetRowAfterFailure( tr ); |
| 60 | 81 | |
| 61 | 82 | } else { |
| 62 | | $('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>'); |
| 63 | | tr.children().css('backgroundColor', ''); |
| | 83 | message = wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ); |
| | 84 | $('#ajax-response').empty().append('<div class="notice notice-error"><p>' + message + '</p></div>'); |
| | 85 | resetRowAfterFailure( tr ); |
| 64 | 86 | } |
| | 87 | wp.a11y.speak( message, 'assertive' ); |
| 65 | 88 | }); |
| 66 | | |
| 67 | | tr.children().css('backgroundColor', '#f33'); |
| 68 | 89 | } |
| 69 | 90 | |
| 70 | 91 | return false; |
| 71 | 92 | }); |
| 72 | 93 | |
| | 94 | /** |
| | 95 | * Restores the original UI state of a table row after an AJAX failure. |
| | 96 | * |
| | 97 | * @param {jQuery} tr The table row to reset. |
| | 98 | * @return {void} |
| | 99 | */ |
| | 100 | function resetRowAfterFailure( tr ) { |
| | 101 | tr.children().css( 'backgroundColor', '' ); |
| | 102 | tr.css( 'pointer-events', '' ); |
| | 103 | tr.find( ':input, a' ).prop( 'disabled', false ).removeAttr( 'tabindex' ); |
| | 104 | } |
| | 105 | |
| 73 | 106 | /** |
| 74 | 107 | * Adds a deletion confirmation when removing a tag. |
| 75 | 108 | * |