Make WordPress Core

Changeset 38197


Ignore:
Timestamp:
08/04/2016 09:06:31 PM (9 years ago)
Author:
ocean90
Message:

Plugins: Also update aria-labels 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.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/src/wp-admin/js/updates.js

    r38188 r38197  
    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.