[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:23:07 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                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:  accessibility
----------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch => needs-patch good-first-bug


Old description:

> 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';
> }
> }}}

New description:

 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';
 }
 }}}

--

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


More information about the wp-trac mailing list