Accessibility: use `aria-current` for the paginated post links output by `wp_link_pages()`.
Continues the introduction in core of the aria-current attribute after [41683], [41359], and [41371]. - changes the `wp_link_pages()` (see the `nextpage` quicktag) output to use an `aria-current` attribute on the current item - adds `post-nav-links` and `post-page-numbers` CSS classes to help themes style these links - updates the related tests Props antonioeatgoat, alexstine. Fixes #41859. Built from https://develop.svn.wordpress.org/trunk@42440 git-svn-id: http://core.svn.wordpress.org/trunk@42270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
351d71d7ea
commit
9c3344197d
|
@ -862,6 +862,7 @@ function post_password_required( $post = null ) {
|
|||
* Quicktag one or more times). This tag must be within The Loop.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @since 5.0.0 Added the `aria_current` argument.
|
||||
*
|
||||
* @global int $page
|
||||
* @global int $numpages
|
||||
|
@ -877,6 +878,8 @@ function post_password_required( $post = null ) {
|
|||
* Also prepended to the current item, which is not linked. Default empty.
|
||||
* @type string $link_after HTML or text to append to each Pages link inside the `<a>` tag.
|
||||
* Also appended to the current item, which is not linked. Default empty.
|
||||
* @type string $aria_current The value for the aria-current attribute. Possible values are 'page',
|
||||
* 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'.
|
||||
* @type string $next_or_number Indicates whether page numbers should be used. Valid values are number
|
||||
* and next. Default is 'number'.
|
||||
* @type string $separator Text between pagination links. Default is ' '.
|
||||
|
@ -893,10 +896,11 @@ function wp_link_pages( $args = '' ) {
|
|||
global $page, $numpages, $multipage, $more;
|
||||
|
||||
$defaults = array(
|
||||
'before' => '<p>' . __( 'Pages:' ),
|
||||
'before' => '<p class="post-nav-links">' . __( 'Pages:' ),
|
||||
'after' => '</p>',
|
||||
'link_before' => '',
|
||||
'link_after' => '',
|
||||
'aria_current' => 'page',
|
||||
'next_or_number' => 'number',
|
||||
'separator' => ' ',
|
||||
'nextpagelink' => __( 'Next page' ),
|
||||
|
@ -924,6 +928,8 @@ function wp_link_pages( $args = '' ) {
|
|||
$link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
|
||||
if ( $i != $page || ! $more && 1 == $page ) {
|
||||
$link = _wp_link_page( $i ) . $link . '</a>';
|
||||
} elseif ( $i === $page ) {
|
||||
$link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $r['aria_current'] ) . '">' . $link . '</span>';
|
||||
}
|
||||
/**
|
||||
* Filters the HTML output of individual page number links.
|
||||
|
@ -1017,7 +1023,7 @@ function _wp_link_page( $i ) {
|
|||
$url = get_preview_post_link( $post, $query_args, $url );
|
||||
}
|
||||
|
||||
return '<a href="' . esc_url( $url ) . '">';
|
||||
return '<a href="' . esc_url( $url ) . '" class="post-page-numbers">';
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-42437';
|
||||
$wp_version = '5.0-alpha-42440';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue