aria-current should not be "page" in certain sets

Created on 17 June 2025, about 1 month ago

Problem/Motivation

In https://www.drupal.org/project/drupal/issues/3038523 📌 Add aria-current attribute to navigation items RTBC 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

🐛 Bug report
Status

Active

Version

11.2 🔥

Component

base system

Created by

🇳🇱Netherlands nvandijk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 🇳🇿New Zealand quietone

    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.

  • 🇳🇱Netherlands makertimswis

    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

  • Production build 0.71.5 2024