WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 11 months ago

#43191 closed enhancement

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

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:
PR Number:

Description (last modified by SergeyBiryukov)

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

See #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 (2)

This ticket was mentioned in Slack in #accessibility by williampatton. View the logs.


22 months ago

#2 @SergeyBiryukov
22 months ago

  • Description modified (diff)
  • Keywords good-first-bug added
Note: See TracTickets for help on using tickets.