Make WordPress Core

Changeset 50801 for trunk


Ignore:
Timestamp:
04/30/2021 10:53:02 PM (3 years ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r50556 r50801  
    132132    $wp_logo_menu_args = array(
    133133        'id'    => 'wp-logo',
    134         'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'About WordPress' ) . '</span>',
     134        'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' . __( 'About WordPress' ) . '</span>',
    135135        'href'  => $about_url,
    136136    );
     
    210210            array(
    211211                'id'    => 'menu-toggle',
    212                 'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
     212                'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
    213213                'href'  => '#',
    214214            )
     
    880880    }
    881881
    882     $title = '<span class="ab-icon"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>';
     882    $title = '<span class="ab-icon" aria-hidden="true"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>';
    883883
    884884    $wp_admin_bar->add_node(
     
    924924    );
    925925
    926     $icon   = '<span class="ab-icon"></span>';
     926    $icon   = '<span class="ab-icon" aria-hidden="true"></span>';
    927927    $title  = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
    928928    $title .= '<span class="screen-reader-text comments-in-moderation-text">' . $awaiting_text . '</span>';
     
    10341034    }
    10351035
    1036     $title  = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
    1037     $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
     1036    $updates_text = sprintf(
     1037        /* translators: %s: Total number of updates available. */
     1038        _n( '%s update available', '%s updates available', $update_data['counts']['total'] ),
     1039        number_format_i18n( $update_data['counts']['total'] )
     1040    );
     1041
     1042    $icon   = '<span class="ab-icon" aria-hidden="true"></span>';
     1043    $title  = '<span class="ab-label" aria-hidden="true">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
     1044    $title .= '<span class="screen-reader-text updates-available-text">' . $updates_text . '</span>';
    10381045
    10391046    $wp_admin_bar->add_node(
    10401047        array(
    10411048            'id'    => 'updates',
    1042             'title' => $title,
     1049            'title' => $icon . $title,
    10431050            'href'  => network_admin_url( 'update-core.php' ),
    1044             'meta'  => array(
    1045                 'title' => $update_data['title'],
    1046             ),
    10471051        )
    10481052    );
Note: See TracChangeset for help on using the changeset viewer.