From ef03b7a378794d29e756577d88edacd8bdd6830b Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Sat, 28 Sep 2024 23:34:28 +0000 Subject: [PATCH] Accessibility: Clarify `aria-label` in pagination links. Change posts and comments pagination `nav` regions to have an aria-label of "Posts pagination" and "Comments pagination", respectively. This provides improved context for the numeric links contained within these regions and differentiates between posts navigation regions and posts pagination regions. Props michaelbourne, sabernhardt, afercia, xyulex, webmandesign, tirth03, joedolson. Fixes #54260. git-svn-id: https://develop.svn.wordpress.org/trunk@59113 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/link-template.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index a3c285b850..61798c3798 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -2931,8 +2931,8 @@ function the_posts_navigation( $args = array() ) { * Optional. Default pagination arguments, see paginate_links(). * * @type string $screen_reader_text Screen reader text for navigation element. - * Default 'Posts navigation'. - * @type string $aria_label ARIA label text for the nav element. Default 'Posts'. + * Default 'Posts pagination'. + * @type string $aria_label ARIA label text for the nav element. Default 'Posts pagination'. * @type string $class Custom class for the nav element. Default 'pagination'. * } * @return string Markup for pagination links. @@ -2955,8 +2955,8 @@ function get_the_posts_pagination( $args = array() ) { 'mid_size' => 1, 'prev_text' => _x( 'Previous', 'previous set of posts' ), 'next_text' => _x( 'Next', 'next set of posts' ), - 'screen_reader_text' => __( 'Posts navigation' ), - 'aria_label' => __( 'Posts' ), + 'screen_reader_text' => __( 'Posts pagination' ), + 'aria_label' => __( 'Posts pagination' ), 'class' => 'pagination', ) ); @@ -3367,8 +3367,8 @@ function the_comments_navigation( $args = array() ) { * @param array $args { * Optional. Default pagination arguments. * - * @type string $screen_reader_text Screen reader text for the nav element. Default 'Comments navigation'. - * @type string $aria_label ARIA label text for the nav element. Default 'Comments'. + * @type string $screen_reader_text Screen reader text for the nav element. Default 'Comments pagination'. + * @type string $aria_label ARIA label text for the nav element. Default 'Comments pagination'. * @type string $class Custom class for the nav element. Default 'comments-pagination'. * } * @return string Markup for pagination links. @@ -3384,8 +3384,8 @@ function get_the_comments_pagination( $args = array() ) { $args = wp_parse_args( $args, array( - 'screen_reader_text' => __( 'Comments navigation' ), - 'aria_label' => __( 'Comments' ), + 'screen_reader_text' => __( 'Comments pagination' ), + 'aria_label' => __( 'Comments pagination' ), 'class' => 'comments-pagination', ) );