From 6ba7c6e93ddedaf26cd6f190c82e5876d313c9c9 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 30 Apr 2021 22:53:02 +0000 Subject: [PATCH] Toolbar: Remove title attribute on pending updates link. Remove the title attribute from the link, wrap the link icon and numeric indicator with the `aria-hidden` attribute, and add a `.screen-reader-text` span so screen readers hear a link that has relevant context without requiring translators to deal with appended strings. Removes the individual counts of theme and plugin updates from the attribute, as those were already buggy and didn't include translation counts. Props afercia, Mte90, sabernhardt, audrasjb Fixes #26562. See #53031. git-svn-id: https://develop.svn.wordpress.org/trunk@50801 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/admin-bar.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index e6fba4b362..5d6d6fe98c 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -131,7 +131,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) { $wp_logo_menu_args = array( 'id' => 'wp-logo', - 'title' => '' . __( 'About WordPress' ) . '', + 'title' => '' . __( 'About WordPress' ) . '', 'href' => $about_url, ); @@ -209,7 +209,7 @@ function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) { $wp_admin_bar->add_node( array( 'id' => 'menu-toggle', - 'title' => '' . __( 'Menu' ) . '', + 'title' => '' . __( 'Menu' ) . '', 'href' => '#', ) ); @@ -879,7 +879,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) { return; } - $title = '' . _x( 'New', 'admin bar menu group label' ) . ''; + $title = '' . _x( 'New', 'admin bar menu group label' ) . ''; $wp_admin_bar->add_node( array( @@ -923,7 +923,7 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) { number_format_i18n( $awaiting_mod ) ); - $icon = ''; + $icon = ''; $title = ''; $title .= '' . $awaiting_text . ''; @@ -1033,17 +1033,21 @@ function wp_admin_bar_updates_menu( $wp_admin_bar ) { return; } - $title = '' . number_format_i18n( $update_data['counts']['total'] ) . ''; - $title .= '' . $update_data['title'] . ''; + $updates_text = sprintf( + /* translators: %s: Total number of updates available. */ + _n( '%s update available', '%s updates available', $update_data['counts']['total'] ), + number_format_i18n( $update_data['counts']['total'] ) + ); + + $icon = ''; + $title = ''; + $title .= '' . $updates_text . ''; $wp_admin_bar->add_node( array( 'id' => 'updates', - 'title' => $title, + 'title' => $icon . $title, 'href' => network_admin_url( 'update-core.php' ), - 'meta' => array( - 'title' => $update_data['title'], - ), ) ); }