Make WordPress Core

Ticket #43191: 43191.diff

File 43191.diff, 602 bytes (added by chetan200891, 7 years ago)

Created patch to add aria-current to aria-current to output of Walker_Nav_Menu for front-end navs

  • src/wp-includes/class-walker-nav-menu.php

    diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php
    index 5e2335a..ff07274 100644
    a b class Walker_Nav_Menu extends Walker { 
    175175                $atts['rel']    = ! empty( $item->xfn ) ? $item->xfn : '';
    176176                $atts['href']   = ! empty( $item->url ) ? $item->url : '';
    177177
     178                if ( in_array( 'current-menu-item', $classes, true ) ) {
     179                        $atts['aria-current'] = 'page';
     180                }
     181
    178182                /**
    179183                 * Filters the HTML attributes applied to a menu item's anchor element.
    180184                 *