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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3530505-2.patch | 2.02 KB | nvandijk |
Issue fork drupal-3530505
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
Comment #2
nvandijk commentedI 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.
Comment #3
nvandijk commentedLooking 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
Comment #4
quietone commentedIf 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.
Comment #5
makertimswisAnother 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