Problem/Motivation

When in a collapsed state (narrow view) a nav tabs element (such as the primary tasks) does not expose its status for a screen reader. That status is managed by only a class name. To expose the state to comply with WCAG 4.1.2. attribute arial-expanded can be used.

Proposed resolution

Add aria-expanded attribute to the tabs element and toggle it at the same time with is-oped class. Remove aria-expanded when displayed as tabs.

Issue fork drupal-3432632

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

simohell created an issue. See original summary.

simohell’s picture

Title: Collpsed nav-tabs status not exposed to screen reader » Collapsed nav-tabs status not exposed to screen reader

simohell’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Can we add an assertion somewhere that checks this attribute to make sure it doesn't break again?

simohell’s picture

We looked at this today at the end of Drupal a11y office hours and based on that I moved the aria attribute to the correct button element. This still doesn't have a test.

mgifford’s picture

Thanks for raising this at today's Drupal A11y Office Hour Simo!

simohell’s picture

Issue summary: View changes
Issue tags: -wcag312 +wcag412
simohell’s picture

@smustgrave About tests: I can see very few tests with themes currently. And this is theme specific f.e. Olivero does this already, but uses a different script. How would we go about testing this?

simohell’s picture

Status: Needs work » Needs review
yevko’s picture

Tested, works well.

smustgrave’s picture

Status: Needs review » Needs work

So we get so few nightwatch tests wasn't sure if the test-only feature worked with nightwatch, it doesn't. And since I'm pretty sure I don't have nightwatch working locally opened a test-only branch with just the test to see it fail.

Unfortunately it didn't

What I meant in #5 was if there was an existing test that we can just put a check that the attribute exists.

simohell’s picture

We agreed to add the duplicate nightwatch test as it is adding a comment with @lauriii during DrupalCamp Finland+Baltics contrib day - since locally it passed and we didn't find examples of nightwatch tests testing multiple themes/modules.

smustgrave’s picture

Ah I gotcha, then nvm!

simohell’s picture

Oh. Now I see that that test actually runs against an Olivero test installation.
So I'll need to make it run with actual Claro. My bad, need to fix it.

simohell’s picture

Now I have a Nightwatch test that uses Claro theme for the test site and fails against 11.x without and succeeds against this MR. So even if it's using much of the test code from Olivero it now actually tests the menu in Claro.

Attaching both the test results run locally.

simohell’s picture

Status: Needs work » Needs review

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Also pushed the change to the test-only branch and got https://git.drupalcode.org/issue/drupal-3432632/-/pipelines/159222

Closed the MR so the bot doesn't pick up on it.

Great job on the tests!

  • nod_ committed bd81352e on 11.x
    Issue #3432632 by simohell, smustgrave, kostyashupenko, andypost:...

  • nod_ committed b8e2a6ab on 10.4.x
    Issue #3432632 by simohell, smustgrave, kostyashupenko, andypost:...

  • nod_ committed 293107a3 on 10.3.x
    Issue #3432632 by simohell, smustgrave, kostyashupenko, andypost:...

nod_ credited andypost.

nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed bd81352 and pushed to 11.x. Thanks!

  • nod_ committed bd81352e on 11.0.x
    Issue #3432632 by simohell, smustgrave, kostyashupenko, andypost:...

Status: Fixed » Closed (fixed)

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