Make WordPress Core

Changeset 36618


Ignore:
Timestamp:
02/22/2016 11:17:21 PM (9 years ago)
Author:
afercia
Message:

Accessibility: Remove title attributes from the Plugin details modal.

Also, improves accessibility of the star rating reviews links.

Fixes #35111.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/common.css

    r36612 r36618  
    25202520#plugin-information .fyi li {
    25212521    margin: 0 0 10px;
     2522}
     2523
     2524#plugin-information .fyi-description {
     2525    margin-top: 0;
    25222526}
    25232527
  • trunk/src/wp-admin/includes/plugin-install.php

    r36297 r36618  
    538538    echo "</div>\n";
    539539
    540     $date_format = __( 'M j, Y @ H:i' );
    541 
    542     if ( ! empty( $api->last_updated ) ) {
    543         $last_updated_timestamp = strtotime( $api->last_updated );
    544     }
    545 
    546540    ?>
    547541    <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
     
    553547            <li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li>
    554548        <?php } if ( ! empty( $api->last_updated ) ) { ?>
    555             <li><strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo esc_attr( date_i18n( $date_format, $last_updated_timestamp ) ); ?>">
    556                 <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?>
    557             </span></li>
     549            <li><strong><?php _e( 'Last Updated:' ); ?></strong>
     550                <?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
     551            </li>
    558552        <?php } if ( ! empty( $api->requires ) ) { ?>
    559553            <li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li>
     
    579573        <h3><?php _e( 'Average Rating' ); ?></h3>
    580574        <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
    581         <small aria-hidden="true"><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
     575        <p aria-hidden="true" class="fyi-description"><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></p>
    582576        <?php }
    583577
    584         if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
     578        if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) { ?>
     579            <h3><?php _e( 'Reviews' ); ?></h3>
     580            <p class="fyi-description"><?php _e( 'Read all reviews on WordPress.org or write your own!' ); ?></p>
     581            <?php
    585582            foreach ( $api->ratings as $key => $ratecount ) {
    586583                // Avoid div-by-zero.
    587584                $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
     585                /* translators: 1: number of stars, 2: number of reviews */
     586                $aria_label = esc_attr( sprintf( _n( 'Reviews with %1$d star: %2$d. Opens in a new window.', 'Reviews with %1$d stars: %2$d. Opens in a new window.', $key ),
     587                    $key,
     588                    number_format_i18n( $ratecount )
     589                ) );
    588590                ?>
    589591                <div class="counter-container">
    590592                    <span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
    591                         target="_blank"
    592                         title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
     593                        target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
    593594                    <span class="counter-back">
    594595                        <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
    595596                    </span>
    596                     <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
     597                    <span class="counter-count" aria-hidden="true"><?php echo number_format_i18n( $ratecount ); ?></span>
    597598                </div>
    598599                <?php
Note: See TracChangeset for help on using the changeset viewer.