Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#43191 closed enhancement

Add aria-current to output of Walker_Nav_Menu for front-end navs — at Initial Version

Reported by: williampatton Owned by:
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Themes Keywords: good-first-bug aria-current has-patch
Focuses: accessibility Cc:


With recent passes on navigations to add aria-current the idea was brought up about placing it on frontend menus too.

See https://core.trac.wordpress.org/ticket/40833 and other related tickets here https://core.trac.wordpress.org/query?keywords=~aria-current

Modifications would be required inside the Walker_Nav_Menu class. I will look closer at the required modifications but something as simple as this could be all that is needed:

if ( in_array( 'current-menu-item', $classes, true ) ) {
	$atts['aria-current'] = 'page';

Change History (0)

Note: See TracTickets for help on using tickets.