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

Previously the label was stuck at "Updating…".

Props afercia, ocean90.
Props DrewAPicture for review.
Fixes #37556.
Built from https://develop.svn.wordpress.org/trunk@38196


git-svn-id: http://core.svn.wordpress.org/trunk@38137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-08-04 21:06:38 +00:00
parent ea6e749c71
commit c9c2377b1d
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.7-alpha-38194';
$wp_version = '4.7-alpha-38196';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.