There is some discussion in Drupal 8 core about adding aria-current="page" to the current active menu link:

This would be a good accessibility improvement to get into D7 themes. Patch forthcoming.

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
StatusFileSize
new1.14 KB

Here's a patch that adds the attribute.

dsnopek’s picture

Based on the info in the referenced issues, it sounds like the internet is heading in the direction of using this and that Drupal 8/9 is gonna follow that path too. And, I trust @cboyden when it comes to accessibility best practices. :-)

The change is simple and non-intrusive - let's do it!

However, when I tested the patch, everything worked, but it doesn't appear to handle tabs like View, Edit, etc. Is that intentional or was it overlooked?

cboyden’s picture

StatusFileSize
new2.27 KB

@dsnopek I've added an implementation of theme_menu_local_task() to the patch - this is the code that you proposed for a child theme, but I've relied on aria-current without any invisible text, which would add verbosity and is probably not needed.

dsnopek’s picture

StatusFileSize
new2.16 KB
new1.15 KB

Thanks, that worked in my testing! Here's a patch that cleans/simplifies the new code a little bit.

  • dsnopek committed 307296a on 7.x-3.x authored by cboyden
    Issue #3109601 by cboyden, dsnopek: Add aria-current attribute to active...
dsnopek’s picture

Status: Needs review » Fixed

Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.