Remove redundant title attribute from `wp_star_rating()`. Hide the visible number of ratings from assistive technologies.

This data is redundant, as the same information is already conveyed by the text hidden with `.screen-reader-text` class.

Props afercia.
Fixes #35141.
Built from https://develop.svn.wordpress.org/trunk@36092


git-svn-id: http://core.svn.wordpress.org/trunk@36057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-12-26 00:48:27 +00:00
parent 7d9d7f2df4
commit 7270205975
5 changed files with 7 additions and 7 deletions

View File

@ -526,7 +526,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
<div class="plugin-card-bottom">
<div class="vers column-rating">
<?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
<span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
<span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
</div>
<div class="column-updated">
<strong><?php _e( 'Last Updated:' ); ?></strong> <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?>

View File

@ -572,7 +572,7 @@ function install_plugin_information() {
<?php if ( ! empty( $api->rating ) ) { ?>
<h3><?php _e( 'Average Rating' ); ?></h3>
<?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
<small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
<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>
<?php }
if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {

View File

@ -2054,7 +2054,7 @@ function wp_star_rating( $args = array() ) {
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
}
$output = '<div class="star-rating" title="' . esc_attr( $title ) . '">';
$output = '<div class="star-rating">';
$output .= '<span class="screen-reader-text">' . $title . '</span>';
$output .= str_repeat( '<div class="star star-full"></div>', $full_stars );
$output .= str_repeat( '<div class="star star-half"></div>', $half_stars );

View File

@ -259,7 +259,7 @@ if ( $tab ) {
<# if ( data.rating ) { #>
<div class="theme-rating">
{{{ data.stars }}}
<span class="num-ratings">({{ data.num_ratings }})</span>
<span class="num-ratings" aria-hidden="true">({{ data.num_ratings }})</span>
</div>
<# } else { #>
<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36091';
$wp_version = '4.5-alpha-36092';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.