[wp-trac] [WordPress Trac] #43191: Add aria-current to output of Walker_Nav_Menu for front-end navs

WordPress Trac noreply at wordpress.org
Thu Feb 1 01:11:12 UTC 2018


#43191: Add aria-current to output of Walker_Nav_Menu for front-end navs
---------------------------+-----------------------------
 Reporter:  williampatton  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Themes         |    Version:
 Severity:  normal         |   Keywords:  needs-patch
  Focuses:  accessibility  |
---------------------------+-----------------------------
 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';
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43191>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list