Make WordPress Core

Changeset 44416


Ignore:
Timestamp:
01/07/2019 01:35:56 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Accessibility: Themes: use aria-current for the Walker_Page current link.

See [42808] for Walker_Nav_Menu.

The aria-current attribute is a simple, effective way to help assistive
technologies users orientate themselves within a list of items. Continues the
introduction in core of aria-current after [42440], [41683], [41359], and [41371].

Props chetan200891, wpzinc.
Fixes #43522.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-page.php

    r44415 r44416  
    159159        $args['link_after']  = empty( $args['link_after'] ) ? '' : $args['link_after'];
    160160
    161         $atts         = array();
    162         $atts['href'] = get_permalink( $page->ID );
     161        $atts                 = array();
     162        $atts['href']         = get_permalink( $page->ID );
     163        $atts['aria-current'] = ( $page->ID == $current_page ) ? 'page' : '';
    163164
    164165        /**
     
    170171         *     The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
    171172         *
    172          *     @type string $href The href attribute.
     173         *     @type string $href         The href attribute.
     174         *     @type string $aria_current The aria-current attribute.
    173175         * }
    174176         * @param WP_Post $page         Page data object.
Note: See TracChangeset for help on using the changeset viewer.