Add a screen reader label to the star rating div to avoid screen readers trying to read the text of the star font.
This commit is contained in:
parent
00a93ae8f0
commit
e74f0acc19
|
@ -3292,7 +3292,8 @@ function wc_get_stock_html( $product ) {
|
|||
* @return string
|
||||
*/
|
||||
function wc_get_rating_html( $rating, $count = 0 ) {
|
||||
$html = 0 < $rating ? '<div class="star-rating">' . wc_get_star_rating_html( $rating, $count ) . '</div>' : '';
|
||||
/* translators: screen reader rating value */
|
||||
$html = 0 < $rating ? '<div class="star-rating" aria-label="' . esc_attr( sprintf( __( 'Rating: %s out of 5', 'woocommerce' ), $rating ) ) . '">' . wc_get_star_rating_html( $rating, $count ) . '</div>' : '';
|
||||
return apply_filters( 'woocommerce_product_get_rating_html', $html, $rating, $count );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue