Accessibility language switch block: role="navigation"

Created on 8 November 2022, over 2 years ago
Updated 3 June 2023, almost 2 years ago

Problem/Motivation

After an accessibility audit by an authority on Accessibility (www.Anysurfer.be) it has become clear that role="navigation" should be removed from language switcher blocks.

The comment was: "r is geen reden om in de accessibility tree van het taalkeuzeblok een navigatieblok te maken."
"> There is no reason to create a navigation block in the accessibility tree of the language switcher block".

Steps to reproduce

Have a multilingual Drupal with a language switcher.

Proposed resolution

Review patch.

Patch removes the role="navigation" addition from the language blocks.

Remaining tasks

Review

Release notes snippet

For accessibility reasons removed role="navigation" from language blocks.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
Language systemΒ  β†’

Last updated about 11 hours ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡§πŸ‡ͺBelgium mschudders

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • Needs accessibility review

    Used to alert the accessibility topic maintainer(s) that an issue significantly affects (or has the potential to affect) the accessibility of Drupal, and their signoff is needed (see the governance policy draft for more information). Useful links: Drupal's accessibility standards, the Drupal Core accessibility gate.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States andystitt829

    I tested the provided patch, and it works.

    Before the patch:

    After the patch:

    I think it's a good idea to not have the language switcher block have the navigation role attached to it as a default. Depending on how it's implemented, it could be a navigation menu on its own, or it could not.

    For example, I inserted it in the header and kept the block title. This made it a navigation menu on its own.

    However, if someone inserted it into the navigation menu, didn't keep the block title, and styled it to look like other items in the navigation menu, then it would be part of the larger navigation menu and not one on its own.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    dcam β†’ changed the visibility of the branch 3319633-accessibility-language-switch to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    dcam β†’ changed the visibility of the branch 11.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    dcam β†’ changed the visibility of the branch 3319633-language-block-role to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    dcam β†’ changed the visibility of the branch 3319633-language-block-role to active.

  • Merge request !11496Remove the language block navigation role β†’ (Open) created by dcam
  • Pipeline finished with Success
    2 months ago
    Total: 851s
    #449726
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I converted the patch in #2 to an MR and added a test.

  • πŸ‡¨πŸ‡¦Canada mgifford Ottawa, Ontario

    I'm not sure that this patch puts us ahead.

    Maybe.

    The comment from the Belgium audit is "There is no reason to create a navigation block in the accessibility tree of the language switcher block". Which isn't to say it is a WCAG error, as much as it isn't needed. Maybe it isn't needed, but maybe that depends on the site setup.

    Is this just two languages? Would it need it (in the view of Anysurfer.be) if there were 5 languages?

    I usually try to find some documentation for this.

    There is no minimum that I could find in:

    @andystitt829 you make good points here. As you say, "it could be a navigation menu on its own, or it could not."

    But if it is going to be brought into another menu, it wouldn't be that difficult to strip out the nav function.

    I do think we need to document how to build a list involving the language switcher where the 'role="navigation' is removed, alternatively, how we add 'role="navigation' should we change the default as per this patch.

    Not having the 'role="navigation' would be a slight simplification of the code. It may not be needed. I do think it would be useful to have some documentation on this with some actual user testing though.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I'm moving to NW for #13 to be added to summary.

  • I have a problem that prevent me to use composer update and apply a patch there for I found an other way:
    I create a jQuerry function that allows me to do what you needed:
    here it is:

    $(document).ready(function () {
            var blocklang = document.getElementById('block-languageswitcher');
            if (blocklang != null) {
              if (blocklang.hasAttribute("role")) {
                blocklang.removeAttribute("role");
              }
            }
    }
    
Production build 0.71.5 2024