Use ARIA disclosure pattern for submenu buttons in vertical toolbar orientation

Created on 9 November 2019, over 5 years ago
Updated 28 February 2024, over 1 year ago

Problem/Motivation

When the manage toolbar is open, in the vertical orientation, sub-menus are available for each section. Visually they are just an icon, but for screen readers there is a visually hidden name.

Currently these buttons conflate the name and state; the name of the button is the opposite of the current state. There's some unnecessary cognitive effort there, to figure out what the current state is.

The behaviour of the button is only conveyed by the name string. The fact that it opens and closes a submenu isn't machine readable.

Proposed resolution

Use aria-expanded to convey the current open/closed state.
Use a constant name for the button: "parent-link-title sub-menu".

The button's name, role, and value will no longer be conflated. There's a clearer indication of the behaviour and current state, which is programmatically understood by assistive tech. Screen reader announcements will be along the lines of "structure submenu, button, expanded" and "structure submenu, button, collapsed".

Remaining tasks

Update JS + templates.
Update tests.

User interface changes

Improves semantics of toolbar submenu buttons for assistive technology.

API changes

None.

Data model changes

None.

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
ToolbarΒ  β†’

Last updated about 12 hours ago

  • Maintained by
  • πŸ‡«πŸ‡·France @nod_
Created by

πŸ‡¬πŸ‡§United Kingdom andrewmacpherson

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.

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.

  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • Made MR based on the following feedback from @maxstarkenburg in #accessibility Slack:

    1. Remove the ["Expand/Collapse" text] because it's redundant with information a screen reader would already announce via aria-expanded.
    2. Depending on who you ask, the button's accessible name (potentially via aria-labelledby) ought to be "[sibling link text]" or "[sibling link text] sub-menu" or "More [sibling link text]".
    3. Also, personally, I would recommend not letting the effort to add aria-controls block this issue (perhaps could be made into a separate issue?), since adding aria-expanded and removing the incorrect state would both be easier wins, adding value sooner. aria-controls seems to have limited AT support and/or be semi-"controversial" in its usefulness, see e.g. https://heydonworks.com/article/aria-controls-is-poop/ and https://github.com/w3c/aria/issues/995
  • Pipeline finished with Success
    over 1 year ago
    Total: 635s
    #106263
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Know it's a task but possible to add a simple assertion that checks the aria value. So we can ensure we don't break this.

  • πŸ‡ΊπŸ‡ΈUnited States chri5tia PDX

    I re-rolled the patch from #4 to work with Drupal 10.4.x

  • πŸ‡ΊπŸ‡ΈUnited States kentr Durango, CO

    Adding Needs Tests based on #19, and related issue.

  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    I know nothing about ARIA recommendations, but on #3286466-50: Tabbing order does not satisfy 508 accessibility requirements β†’ , @rkoller suggested using aria-pressed instead of aria-expanded:

    ... But i wonder if aria-expanded is the right choice for a toggle button. I always have problem as a sighted user understanding the current state for toggle buttons that change their label inbetween states. A point that Leonie Watson also illustrated in their talk for smashing magazine: https://youtu.be/OUDV1gqs9GA?t=3222 . She advocated to use aria-pressed instead. That way the button state is either pressed/selected or not and the button label remains the same between states. That way things are completely clear and unambiguous for screen reader users?

    Does that apply here? Should we consider it?

    @andrewmacpherson: It has been more than 5 years since you self-assigned this issue and last commented. I am un-assigning it now.

  • πŸ‡ΊπŸ‡ΈUnited States kentr Durango, CO

    @benjfisher

    ...@rkoller suggested using aria-pressed instead of aria-expanded...
    Does that apply here? Should we consider it?

    The place in the video that @rkoller linked is regarding a button that toggles light / dark mode. aria-expanded wouldn't apply to that, I believe, because in that use-case there's nothing to expand or show.

    Later in the video, there's an example of a show / hide toggle button with aria-expanded. The video creator appears to approve of that use.

    There's a separate question of whether to change the "label" (visual display) when the toggle is activated. I can't speak to that. I find changing icons for show / hide widgets (like the orientation of a caret) to be helpful.

  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    @kentr:

    Thanks for the reply (here and on the related issue).

    I will try to find time to add some tests coverage for this issue. From the comments, that is the only thing holding it back. (The Remaining tasks list "Update JS + templates". I think that is already done, although the current MR changes only one JS file, no templates. If I have that right, can someone that item?)

Production build 0.71.5 2024