Upgrade/Install: Update screen reader text counts in adminbar.

Update the hidden screen-reader-text update count in the adminbar when updates are run on the plugin or theme screens.

Props pento, paulschreiber, adamsilverstein, afercia, SergeyBiryukov, sabernhardt.
Fixes #29022.

git-svn-id: https://develop.svn.wordpress.org/trunk@52139 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2021-11-11 17:19:58 +00:00
parent 206ee73bdd
commit 7b61f1305a

View File

@ -33,6 +33,7 @@
var $document = $( document ),
__ = wp.i18n.__,
_x = wp.i18n._x,
_n = wp.i18n._n,
sprintf = wp.i18n.sprintf;
wp = wp || {};
@ -352,8 +353,14 @@
$appearanceNavMenuUpdateCount = $( 'a[href="themes.php"] .update-plugins' ),
itemCount;
$adminBarUpdates.find( '.ab-item' ).removeAttr( 'title' );
$adminBarUpdates.find( '.ab-label' ).text( settings.totals.counts.total );
$adminBarUpdates.find( '.updates-available-text' ).text(
sprintf(
/* translators: %s: Total number of updates available. */
_n( '%s update available', '%s updates available', settings.totals.counts.total ),
settings.totals.counts.total
)
);
// Remove the update count from the toolbar if it's zero.
if ( 0 === settings.totals.counts.total ) {