Many themes (including bundled themes) use previous/next navigation in single post and pagination links in the posts/comments archives.
The markup output is under the responsibility of core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. private function _navigation_markup
, which prints out an unlabelled <nav>
element:
<nav class="navigation post-navigation" role="navigation">
This <nav>
element defines an ARIA landmark by default: landmarks help assistive technology Assistive technology is an umbrella term that includes assistive, adaptive, and rehabilitative devices for people with disabilities and also includes the process used in selecting, locating, and using them. Assistive technology promotes greater independence by enabling people to perform tasks that they were formerly unable to accomplish, or had great difficulty accomplishing, by providing enhancements to, or changing methods of interacting with, the technology needed to accomplish such tasks.
https://en.wikipedia.org/wiki/Assistive_technology users to perceive the page main sections and jump through them. However, when a landmark is used more than once in a page, it needs to be distinguished from the other ones to let users understand what the landmark is about.
For reference, see ARIA Landmarks Example on W3.org.
To distinguish each context WordPress 5.3 will programmatically add specific aria-label
parameter for each navigation menu A theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for giving various control options to get users to click from one place to another on a site.. That parameter is being added to navigation menus generated by the following functions:
_navigation_markup()
get_the_post_navigation()
get_the_posts_navigation()
get_the_posts_pagination()
get_the_comments_navigation()
get_the_comments_pagination()
The following functions are also impacted as they are used to echo the result of the functions listed above:
the_post_navigation()
the_posts_navigation()
the_posts_pagination()
the_comments_navigation()
the_comments_pagination()
All these functions now implement aria_label
parameter which can be used to pass custom value for the related HTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. attribute.
For example:
the_post_navigation( array(
'prev_text' => __( 'previous: %title', 'text-domain' ),
'next_text' => __( 'next: %title', 'text-domain' ),
'taxonomy' => 'chapters',
'aria_label' => __( 'Chapters', 'text-domain' ),
) );
For reference, see the related Trac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. ticket Created for both bug reports and feature development on the bug tracker.: #47123
#5-3, #accessibility, #dev-notes