Problem/Motivation

In https://www.drupal.org/project/drupal/issues/3038523 functionality was introduced to set the aria-current attribute to 'page' when the current item is active.
However, I recently received an accessibility report which states this is not the correct attribute and that it should be set to 'true' within the Language switcher context.

Also see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Referenc... where "page" is mentioned to be for the breadcrumb. Whereas "true" is meant for an active page within a set.

Steps to reproduce

Proposed resolution

Check if the aria-current attribute is already set, to be able to override it in certain situations.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3530505-2.patch2.02 KBnvandijk

Issue fork drupal-3530505

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nvandijk created an issue. See original summary.

nvandijk’s picture

StatusFileSize
new2.02 KB

I made a quick proof of concept to be able to override the aria-current for the language block. See https://git.drupalcode.org/issue/drupal-3530505/-/tree/3530505-aria-curr....

Also adding a patch for own use.

nvandijk’s picture

Looking further into this we might need to revise the working of '#set_active_class' (as used in LanguageBlock.php). Maybe making this more of a feature request than a bug report.

This currently only supports a boolean value and also sets the attributes of the wrapping

  • - which causes the aria-current to be applied on both the li and the a.
  • quietone’s picture

    Version: 11.2.x-dev » 11.x-dev

    If this problem was discovered on a version of Drupal that is not 11.x, add that information in the issue summary and leave the version at 11.x. In Drupal core changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies. Also mentioned on the version section of the list of issue fields documentation.

    makertimswis’s picture

    Another way of implementing this could be by making use of the `#set_active_class`
    Currently, it's only supporting TRUE / (default) FALSE, but by adding string support with 'page', (string) 'true', 'step', 'location', 'date' and 'time' the correct aria label could set based on the usage

    This way the place of implementing is responsible for the context, API change is minimal (even backwards compatible possible) and responsibility at the implementer (where context is the highest)
    I could make a work-in-progress patch if this is a preferred route to take

    Version: 11.x-dev » main

    Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

    Read more in the announcement.