Make WordPress Core

Changeset 45318


Ignore:
Timestamp:
05/16/2019 04:33:42 PM (6 years ago)
Author:
desrosj
Message:

Accessibility: Add aria-current to the links in the <nav> elements introduced in [44905].

Also fixes a few translators comments and coding standards.

Merges [45300] to the 5.2 branch.

Props audrasjb, afercia.
Fixes #47106.

Location:
branches/5.2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/src/wp-admin/about.php

    r45288 r45318  
    3535
    3636        <nav class="nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    37             <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What&#8217;s New' ); ?></a>
     37            <a href="about.php" class="nav-tab nav-tab-active" aria-current="page"><?php _e( 'What&#8217;s New' ); ?></a>
    3838            <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a>
    3939            <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
  • branches/5.2/src/wp-admin/credits.php

    r45293 r45318  
    1919<div class="wrap about-wrap full-width-layout">
    2020
    21 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
     21<h1>
     22    <?php
     23    /* translators: %s: The current WordPress version number */
     24    printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version );
     25    ?>
     26</h1>
    2227
    2328<p class="about-text"><?php printf( __( 'Congratulations on updating to WordPress 5.2! This update makes it easier than ever to fix your site if something goes wrong.' ), $display_version ); ?></p>
    2429
    25 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
     30<div class="wp-badge">
     31    <?php
     32    /* translators: %s: The current WordPress version number */
     33    printf( __( 'Version %s' ), $display_version );
     34    ?>
     35</div>
    2636
    2737<nav class="nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    2838    <a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
    29     <a href="credits.php" class="nav-tab nav-tab-active"><?php _e( 'Credits' ); ?></a>
     39    <a href="credits.php" class="nav-tab nav-tab-active" aria-current="page"><?php _e( 'Credits' ); ?></a>
    3040    <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
    3141    <a href="freedoms.php?privacy-notice" class="nav-tab"><?php _e( 'Privacy' ); ?></a>
     
    3949if ( ! $credits ) {
    4050    echo '<p class="about-description">';
    41     /* translators: 1: https://wordpress.org/about/, 2: https://make.wordpress.org/ */
    4251    printf(
     52        /* translators: 1: https://wordpress.org/about/, 2: https://make.wordpress.org/ */
    4353        __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
    4454        'https://wordpress.org/about/',
     
    124134// These are strings returned by the API that we want to be translatable
    125135__( 'Project Leaders' );
     136/* translators: %s: The current WordPress version number */
    126137__( 'Core Contributors to WordPress %s' );
    127138__( 'Noteworthy Contributors' );
  • branches/5.2/src/wp-admin/freedoms.php

    r45293 r45318  
    1919
    2020if ( $is_privacy_notice ) {
    21     $freedoms_class = '';
    22     $privacy_class  = ' nav-tab-active';
     21    $freedoms_class        = '';
     22    $privacy_class         = ' nav-tab-active';
     23    $freedoms_aria_current = '';
     24    $privacy_aria_current  = ' aria-current="page"';
    2325} else {
    24     $freedoms_class = ' nav-tab-active';
    25     $privacy_class  = '';
     26    $freedoms_class        = ' nav-tab-active';
     27    $privacy_class         = '';
     28    $freedoms_aria_current = ' aria-current="page"';
     29    $privacy_aria_current  = '';
    2630}
    2731
     
    2933<div class="wrap about-wrap full-width-layout">
    3034
    31 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
     35<h1>
     36    <?php
     37    /* translators: %s: The current WordPress version number */
     38    printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version );
     39    ?>
     40</h1>
    3241
    3342<p class="about-text"><?php printf( __( 'Congratulations on updating to WordPress 5.2! This update makes it easier than ever to fix your site if something goes wrong.' ), $display_version ); ?></p>
    3443
    35 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
     44<div class="wp-badge">
     45    <?php
     46    /* translators: %s: The current WordPress version number */
     47    printf( __( 'Version %s' ), $display_version );
     48    ?>
     49</div>
    3650
    3751<nav class="nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    3852    <a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
    3953    <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a>
    40     <a href="freedoms.php" class="nav-tab<?php echo $freedoms_class; ?>"><?php _e( 'Freedoms' ); ?></a>
    41     <a href="freedoms.php?privacy-notice" class="nav-tab<?php echo $privacy_class; ?>"><?php _e( 'Privacy' ); ?></a>
     54    <a href="freedoms.php" class="nav-tab<?php echo $freedoms_class; ?>"<?php echo $freedoms_aria_current; ?>><?php _e( 'Freedoms' ); ?></a>
     55    <a href="freedoms.php?privacy-notice" class="nav-tab<?php echo $privacy_class; ?>"<?php echo $privacy_aria_current; ?>><?php _e( 'Privacy' ); ?></a>
    4256</nav>
    4357
     
    4761    <p class="about-description"><?php _e( 'From time to time, your WordPress site may send data to WordPress.org &#8212; including, but not limited to &#8212; the version of WordPress you are using, and a list of installed plugins and themes.' ); ?></p>
    4862
    49     <p><?php printf( __( 'This data is used to provide general enhancements to WordPress, which includes helping to protect your site by finding and automatically installing new updates. It is also used to calculate statistics, such as those shown on the <a href="%s">WordPress.org stats page</a>.' ), 'https://wordpress.org/about/stats/' ); ?></p>
     63    <p>
     64        <?php
     65        /* translators: %s: https://wordpress.org/about/stats/ */
     66        printf( __( 'This data is used to provide general enhancements to WordPress, which includes helping to protect your site by finding and automatically installing new updates. It is also used to calculate statistics, such as those shown on the <a href="%s">WordPress.org stats page</a>.' ), 'https://wordpress.org/about/stats/' );
     67        ?>
     68    </p>
    5069
    51     <p><?php printf( __( 'We take privacy and transparency very seriously. To learn more about what data we collect, and how we use it, please visit <a href="%s">WordPress.org/about/privacy</a>.' ), 'https://wordpress.org/about/privacy/' ); ?></p>
     70    <p>
     71        <?php
     72        /* translators: %s: https://wordpress.org/about/privacy/ */
     73        printf( __( 'We take privacy and transparency very seriously. To learn more about what data we collect, and how we use it, please visit <a href="%s">WordPress.org/about/privacy</a>.' ), 'https://wordpress.org/about/privacy/' );
     74        ?>
     75    </p>
    5276</div>
    5377
     
    5680    <div class="feature-section has-1-columns">
    5781        <h2><?php _e( 'Freedoms' ); ?></h2>
    58         <p class="about-description"><?php printf( __( 'WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.' ), 'https://wordpress.org/about/license/' ); ?></p>
     82        <p class="about-description">
     83        <?php
     84            /* translators: %s: https://wordpress.org/about/license/ */
     85            printf( __( 'WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.' ), 'https://wordpress.org/about/license/' );
     86        ?>
     87        </p>
    5988    </div>
    6089
     
    83112
    84113    <div class="feature-section has-1-columns">
    85         <p><?php printf( __( 'WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We&#8217;re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.' ), 'https://wordpressfoundation.org/trademark-policy/' ); ?></p>
     114        <p>
     115        <?php
     116            /* translators: %s: https://wordpressfoundation.org/trademark-policy/ */
     117            printf( __( 'WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We&#8217;re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.' ), 'https://wordpressfoundation.org/trademark-policy/' );
     118        ?>
     119        </p>
    86120
    87121        <p>
     
    89123            $plugins_url = current_user_can( 'activate_plugins' ) ? admin_url( 'plugins.php' ) : __( 'https://wordpress.org/plugins/' );
    90124            $themes_url  = current_user_can( 'switch_themes' ) ? admin_url( 'themes.php' ) : __( 'https://wordpress.org/themes/' );
    91 
     125            /* translators: %s: https://wordpress.org/about/license/ */
    92126            printf( __( 'Every plugin and theme in WordPress.org&#8217;s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it&#8217;s GPL</a> first. If they don&#8217;t respect the WordPress license, we don&#8217;t recommend them.' ), $plugins_url, $themes_url, 'https://wordpress.org/about/license/' );
    93127        ?>
  • branches/5.2/src/wp-admin/includes/ms.php

    r45084 r45318  
    11191119        $classes = array( 'nav-tab' );
    11201120
     1121        // Aria-current attribute.
     1122        $aria_current = '';
     1123
    11211124        // Selected is set by the parent OR assumed by the $pagenow global
    11221125        if ( $r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
    1123             $classes[] = 'nav-tab-active';
     1126            $classes[]    = 'nav-tab-active';
     1127            $aria_current = ' aria-current="page"';
    11241128        }
    11251129
     
    11311135
    11321136        // Add link to nav links
    1133         $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '">' . esc_html( $link['label'] ) . '</a>';
     1137        $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html( $link['label'] ) . '</a>';
    11341138    }
    11351139
  • branches/5.2/src/wp-admin/nav-menus.php

    r45140 r45318  
    621621
    622622    $nav_tab_active_class = '';
     623    $nav_aria_current     = '';
    623624    if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) {
    624625        $nav_tab_active_class = ' nav-tab-active';
     626        $nav_aria_current     = ' aria-current="page"';
    625627    }
    626628    ?>
     
    629631
    630632    <nav class="nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    631         <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php echo $nav_tab_active_class; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
     633        <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php echo $nav_tab_active_class; ?>"<?php echo $nav_aria_current; ?>><?php esc_html_e( 'Edit Menus' ); ?></a>
    632634        <?php
    633635        if ( $num_locations && $menu_count ) {
    634636            $active_tab_class = '';
     637            $aria_current     = '';
    635638            if ( $locations_screen ) {
    636639                $active_tab_class = ' nav-tab-active';
     640                $aria_current     = ' aria-current="page"';
    637641            }
    638642            ?>
    639             <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php echo $active_tab_class; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
     643            <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php echo $active_tab_class; ?>"<?php echo $aria_current; ?>><?php esc_html_e( 'Manage Locations' ); ?></a>
    640644            <?php
    641645        }
     
    879883                    }
    880884                    ?>
    881                      <input type="hidden" name="action" value="update" />
     885                    <input type="hidden" name="action" value="update" />
    882886                    <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
    883887                    <div id="nav-menu-header">
     
    957961                                                <span class="theme-location-set">
    958962                                                <?php
    959                                                     /* translators: %s: menu name */
    960963                                                    printf(
     964                                                        /* translators: %s: menu name */
    961965                                                        _x( '(Currently set to: %s)', 'menu location' ),
    962966                                                        wp_get_nav_menu_object( $menu_locations[ $location ] )->name
Note: See TracChangeset for help on using the changeset viewer.