Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294932

Add aria-current attribute to navigation items

$
0
0

Problem/Motivation

In a set of links such as a menu, the currently-active link has the is-active class added so it can be styled to make it visually apparent that this link goes to the current page. This information should also be made available programmatically. In order to do this, the aria-current attribute can be set to "page."

The attribute should be added to the link, not a list item or other element. If the currently-active item is not linked to (for example, if the link is removed when the target is the current page, such as in breadcrumbs where the page title is displayed), then the aria-current attribute is not required.

References:

Steps to reproduce

  1. Install the latest version of Drupal using the standard profile.
  2. Create three basic pages and add them to the main menu. Note they appear as links in the main menu region.
  3. Follow one of the links in the main menu.
  4. Inspect the code of the link to the current page. Note that it is still a link and it has the is-active class. Note that it does not have an aria-current attribute.

Proposed resolution

Add aria-current="page" to all links where the is-active class is being added. Do not add the attribute to non-links; do not add it when the current item is not a page (for example, tab panels, steps in a form, etc).

Remaining tasks

Manual testing of other places where the is-active class is added. Test pagination links in Views etc.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD.


Viewing all articles
Browse latest Browse all 294932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>