From b63aae09879588367b1699769895be1afac19023 Mon Sep 17 00:00:00 2001 From: Gabriel Manussakis Date: Sat, 14 Sep 2024 17:11:17 -0300 Subject: [PATCH] Account for two dots elements to add aria-label to page link --- plugins/woocommerce/includes/wc-template-functions.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce/includes/wc-template-functions.php b/plugins/woocommerce/includes/wc-template-functions.php index b6a9f6d8a55..c8b1ad29de8 100644 --- a/plugins/woocommerce/includes/wc-template-functions.php +++ b/plugins/woocommerce/includes/wc-template-functions.php @@ -4161,11 +4161,10 @@ function wc_add_aria_label_to_pagination_numbers( $html, $args ) { } if ( $p->has_class( 'dots' ) ) { - // If current page is before the dots. - if ( $args['current'] + $args['mid_size'] < $args['total'] - $args['end_size'] ) { - $n = $args['total'] - $args['end_size']; - } else { + if ( $args['current'] - $args['mid_size'] > $n ) { $n = $args['current'] - $args['mid_size'] - 1; + } else { + $n = $args['total'] - $args['end_size']; } ++$n; continue;