Plugins: Also update `aria-label`s when a plugin update fails.

Previously the label was stuck at "Updating…".

Merge of [38196] to the 4.6 branch.

Props afercia, ocean90.
Props DrewAPicture for review.
See #37556.
Built from https://develop.svn.wordpress.org/branches/4.6@38197


git-svn-id: http://core.svn.wordpress.org/branches/4.6@38138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-08-04 21:07:35 +00:00
parent 6b9501b9c7
commit 6ece312820
3 changed files with 15 additions and 4 deletions

View File

@ -453,6 +453,13 @@
$message = $( 'tr[data-slug="' + response.slug + '"]' ).find( '.update-message' );
}
$message.removeClass( 'updating-message notice-warning' ).addClass( 'notice-error' ).find( 'p' ).html( errorMessage );
if ( response.pluginName ) {
$message.find( 'p' )
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
} else {
$message.find( 'p' ).removeAttr( 'aria-label' );
}
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
$card = $( '.plugin-card-' + response.slug )
.addClass( 'plugin-card-update-failed' )
@ -467,6 +474,8 @@
if ( response.pluginName ) {
$card.find( '.update-now' )
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
} else {
$card.find( '.update-now' ).removeAttr( 'aria-label' );
}
$card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() {
@ -1591,14 +1600,16 @@
// Change buttons of all running updates.
$( '.button.updating-message' )
.removeClass( 'updating-message' )
.attr( 'aria-label', wp.updates.l10n.updateFailedShort )
.removeAttr( 'aria-label' )
.prop( 'disabled', true )
.text( wp.updates.l10n.updateFailedShort );
$( '.updating-message:not(.button):not(.thickbox)' )
.removeClass( 'updating-message notice-warning' )
.addClass( 'notice-error' )
.find( 'p' ).text( errorMessage );
.find( 'p' )
.removeAttr( 'aria-label' )
.text( errorMessage );
wp.a11y.speak( errorMessage, 'assertive' );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-RC1-38195';
$wp_version = '4.6-RC1-38197';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.