Editor: Hide query loop pagination link arrows from assistive technology.

This changeset adss an `aria-hidden="true"` attribute to the optional arrows/chevron characters to the Query Loop and to the Comments Query Loop blocks pagination links.

These characters are text, so they're read out by assistive technologies. For better accessibility, it's best to reduce noise for screen reader users and prevent them to be rendered, using the `aria-hidden="true"` attribute.

Follow-up to [52057].

Props afercia, sabernhardt, kamig478, zieladam, audrasjb, joedolson, costdev.
Fixes #56067.


git-svn-id: https://develop.svn.wordpress.org/trunk@54138 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-09-12 23:32:57 +00:00
parent 0ad353d250
commit 926f3f84a5

View File

@@ -1256,7 +1256,7 @@ function get_query_pagination_arrow( $block, $is_next ) {
$arrow_attribute = $block->context['paginationArrow'];
$arrow = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ];
$arrow_classes = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute";
return "<span class='$arrow_classes'>$arrow</span>";
return "<span class='$arrow_classes' aria-hidden='true'>$arrow</span>";
}
return null;
}
@@ -1405,7 +1405,7 @@ function get_comments_pagination_arrow( $block, $pagination_type = 'next' ) {
$arrow_attribute = $block->context['comments/paginationArrow'];
$arrow = $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ];
$arrow_classes = "wp-block-comments-pagination-$pagination_type-arrow is-arrow-$arrow_attribute";
return "<span class='$arrow_classes'>$arrow</span>";
return "<span class='$arrow_classes' aria-hidden='true'>$arrow</span>";
}
return null;
}