Make WordPress Core

Changeset 38196


Ignore:
Timestamp:
08/04/2016 09:05:19 PM (10 years ago)
Author:
ocean90
Message:

Plugins: Also update aria-labels when a plugin update fails.

Previously the label was stuck at "Updating…".

Props afercia, ocean90.
Props DrewAPicture for review.
Fixes #37556.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/updates.js

    r38186 r38196  
    454454                        }
    455455                        $message.removeClass( 'updating-message notice-warning' ).addClass( 'notice-error' ).find( 'p' ).html( errorMessage );
     456
     457                        if ( response.pluginName ) {
     458                                $message.find( 'p' )
     459                                        .attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
     460                        } else {
     461                                $message.find( 'p' ).removeAttr( 'aria-label' );
     462                        }
    456463                } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
    457464                        $card = $( '.plugin-card-' + response.slug )
    … …  
    468475                                $card.find( '.update-now' )
    469476                                        .attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
     477                        } else {
     478                                $card.find( '.update-now' ).removeAttr( 'aria-label' );
    470479                        }
    471480
    … …  
    15921601                $( '.button.updating-message' )
    15931602                        .removeClass( 'updating-message' )
    1594                         .attr( 'aria-label', wp.updates.l10n.updateFailedShort )
     1603                        .removeAttr( 'aria-label' )
    15951604                        .prop( 'disabled', true )
    15961605                        .text( wp.updates.l10n.updateFailedShort );
    … …  
    15991608                        .removeClass( 'updating-message notice-warning' )
    16001609                        .addClass( 'notice-error' )
    1601                         .find( 'p' ).text( errorMessage );
     1610                        .find( 'p' )
     1611                                .removeAttr( 'aria-label' )
     1612                                .text( errorMessage );
    16021613
    16031614                wp.a11y.speak( errorMessage, 'assertive' );
Note: See TracChangeset for help on using the changeset viewer.