Dropbutton widget not accessible to screen readers

Created on 13 April 2023, about 1 year ago
Updated 24 June 2024, 2 days ago

Problem/Motivation

The dropbutton widget from core does not work well with screen readers:

  1. The change in state of the dropdown (visible or not) is not communicated to the screen reader.
  2. The toggle button's screen reader text says "list additional actions" which is unclear, especially if the dropdown is open.
  3. The dropdown automatically closes after focusing out, which may be confusing for screen reader users if they aren't aware it closed. This behavior is inconsistent for mouse users as well since the button opens on click, but closes by hovering out.

Steps to reproduce

Visit a page that has dropbuttons such as /admin/structure/types.

  1. Use a screen reader or emulator and open/close the dropdown. The change of visibility to dropdown menu is not communicated to the screen reader.
  2. Focus the screen reader on the toggle button to hear the text "list additional actions".
  3. Using the keyboard, open the dropdown, then tab away from it. The dropdown closes automatically.

Proposed resolution

  1. Implement aria-expanded and aria-controls attributes to communicate the open/closed state.
  2. Change the arrow button's screen reader text to just "additional actions".
  3. Have the dropdown stay open after focusing/hovering out - to close it, users should click the arrow button again.

User interface changes

Screenshots (gray box indicates VoiceOver text):

Before:

After:

✨ Feature request
Status

Needs work

Version

11.0 🔥

Component
Theme  →

Last updated about 2 hours ago

Created by

🇺🇸United States liembo

Live updates comments and jobs are added and updated live.
  • 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

  • Issue created by @liembo
  • 🇺🇸United States liembo
  • Working on MR, I think it will be necessary to put the secondary actions in their own

      element so it can be marked as aria-expanded.

      Noticed an additional inconsistency (at least in 9.5): hovering over the dropdown toggle button doesn't open it (you need to click), but hovering out closes it automatically. I think it should be the same action to open and close, and my preference would be clicking (so the open state does not depend on where you cursor is). So if a user with a hand tremor or other mobility impairment opens the menu and accidentally moves the cursor away, they can still access it.

      Additional accessibility issue: it should be possible to dismiss the dropdown by pressing "Esc" ( reference - https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html )

  • last update about 1 year ago
    Custom Commands Failed
  • @camilledaviscivicactionscom opened merge request.
  • last update about 1 year ago
    Custom Commands Failed
  • last update about 1 year ago
    Custom Commands Failed
  • last update about 1 year ago
    30,322 pass
  • This MR:

    • Puts the secondary actions in a sublist
    • Adds aria-expanded and aria-controls attributes to the toggle button
    • Changes the toggle button text to "Show additional actions" or "Hide additional actions"
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

    Could we add some before/after screenshots to the issue summary since the css is changing. To make sure nothing broke.

    Tagging for accessibility. I currently only have ANDI installed but could use the voice over if no one gets to it.

  • 🇺🇸United States bnjmnm Ann Arbor, MI

    Left some feedback on the MR.

    This is an issue with dropbuttons in general, not specific to Claro, the title and issue summary should reflect that, and this should be tested in every core theme

    Many of the problems with Dropbutton will be fixed with the new Splitbutton element, if that issue lands: ✨ Add new Splitbutton render element to eventually replace Dropbutton Needs work .
    Converting to Splitbutton will not be something that can happen immediately after it is committed, so addressing Dropbutton issues is still valuable - but also be aware one of the reason Splitbutton work even happened is because it's proven difficult to implement Dropbutton improvements that don't introduce regressions or other problems.

  • Just realized an additional issue, the dropbuttons close automatically half a second after losing focus. This seems confusing for screen readers / magnifiers, even after fixing the aria attributes to match the state, you wouldn't necessarily expect it to change. Also the buttons don't open on focus/hover, so it seems inconsistent to have them close automatically on focusout

  • 🇨🇦Canada mgifford Ottawa, Ontario

    I haven't tested with a screen reader yet @camilledavis, but definitely agree that the behavior in losing focus is a problem. It is a relatively small area. Folks shouldn't have to keep it over that small spot to continue reading the menu.

    I attached a movie of the experience.

  • 🇨🇦Canada mgifford Ottawa, Ontario

    I can confirm in the /admin/structure/taxonomy

    That the focus state is not announced to the screen reader user.

    Here's a simple recording with VoiceOver.

  • Status changed to Needs review 8 months ago
  • Pipeline finished with Failed
    8 months ago
    Total: 824s
    #43528
  • Status changed to Needs work 8 months ago
  • Pipeline finished with Failed
    8 months ago
    #44106
  • Pipeline finished with Success
    8 months ago
    Total: 698s
    #44109
  • Status changed to Needs review 8 months ago
  • 🇺🇸United States smustgrave

    Can issue summary be updated please. Also screenshots added to it

  • Status changed to Needs work 8 months ago
  • 🇺🇸United States smustgrave
  • Pipeline finished with Success
    about 2 months ago
    #161130
  • Status changed to Needs review about 2 months ago
  • Pipeline finished with Success
    about 2 months ago
    Total: 625s
    #161157
  • Status changed to Needs work about 2 months ago
  • 🇺🇸United States smustgrave

    If changing aria labels and text can we add some assertions somewhere to make sure they don’t break in the future.

  • Sure, where should it go? I'm guessing Nightwatch/Tests/ and make a file called dropbuttonTest.js?

  • Pipeline finished with Failed
    about 2 months ago
    Total: 193s
    #166730
  • Pipeline finished with Failed
    about 2 months ago
    Total: 166s
    #169985
  • Pipeline finished with Success
    about 2 months ago
    Total: 573s
    #170032
  • Status changed to Needs review about 2 months ago
  • 🇺🇸United States smustgrave

    Screenshots appear to have been added and issue summary updated

    Believe this is ready for accessibility.

  • 🇩🇪Germany rkoller Nürnberg, Germany

    I've tested MR5231 and created a short video (see dropbutton.mp4 - recorded on macOS 14.5 and safari 17.5 with voiceover). In general the first point of the proposed solution looks good, the open and closed state are commenunicated, that's perfect.

    In regards of the second point reducing the drop button label from "list additional actions" to just "additional actions" is a good choice, i agree to that. The only thing i wonder is if it would make sense to append the context the button is in, front load "additional actions" and then append the context. that way a screenreader user could jump off at any time but still has the option or in case the person has a small working memory to reassure it is the correct button in the correct context (also if someone navigates by the rotor). the edit button as well as the delete option already provide that context while the additional actions button and translate option do not? I would consider it out of the scope for this issue but moving "providing a context" into a follow up might be a reasonable step, what do you think?

    In regards of the third point, keeping the dropdown up when focus and hover are out i consider a good thing but as soon as another drop button is expanded it looks and feels odd (check dropdown.mp4)? wouldnt it make sense to collapse a drop button as soon as another is expanded? would be the same pattern that was used for the subnav of top level menu items in the admin_toolbar?

    and @camilledavis you've suggested to allow the user to collapse the drop button by pressing ESC in #4 ✨ Dropbutton widget not accessible to screen readers Needs review . I would +1 that option.

  • 🇨🇦Canada mgifford Ottawa, Ontario

    Thanks @rkoller this is great. I'd like to see this patch include Ralf's suggestion to collapse the first drop button as soon as another drop button is expanded. We don't want to introduce an accessibility issue for keyboard only users, by fixing an issue for screen reader users.

    I would say that from Ralf's demo that the patch would currently violate SC 2.4.11: Focus Not Obscured (Minimum) (Level AA).

    Let's open up a follow-up item about the drop button label, as suggested by Ralf.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 178s
    #177512
  • Status changed to Needs work about 1 month ago
  • The Needs Review Queue Bot → tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.

  • 🇨🇦Canada mgifford Ottawa, Ontario

    Can we get someone to re-roll this patch?

  • 🇺🇸United States dmundra Eugene, OR

    Hey @mgifford, I am not seeing an conflicts so no need to re-roll I think till we get traction on this.

  • First commit to issue fork.
  • Pipeline finished with Failed
    14 days ago
    Total: 204s
    #197501
  • Pipeline finished with Failed
    14 days ago
    Total: 578s
    #197525
  • Assigned to Tirupati_Singh
  • Pipeline finished with Failed
    13 days ago
    Total: 531s
    #197809
  • Issue was unassigned.
  • Status changed to Needs review 13 days ago
  • 🇮🇳India Tirupati_Singh

    Hi @mgifford, I tested the MR!5231, the button state has been communicated well. But I found one issue regarding the dropdown button toggle state. When focusing on the dropdown button for the first time the screen reader reads as additional actions, button collapsed and additional actions, button expanded when the dropdown button list has been expanded. But then after when focusing on dropbutton it always announces as additional actions, button expanded even after the list has been collapsed.
    I've resolved this issue. Now the button state is communicating additional actions, button expanded when the dropdown button list expands and additional actions, button collapsed when the dropdown button list has been collapsed. Please review the changes.

  • 🇮🇳India Tirupati_Singh

    Hi @mgifford, attached the before and after video clips for the screen reader dropdown expanded and collapsed announce issue.

  • Status changed to Needs work 6 days ago
  • 🇺🇸United States smustgrave

    Appears to have test failures now.

  • 🇺🇸United States bnjmnm Ann Arbor, MI

    In the JS it looks like a good amount of additional logic is going into supporting aria-controls, but given that only the JAWS screenreader supports it, and a trusted A11y expert has deemed aria-controls to be poop. Since aria-controls support is so limited it is not likely causing any AT problems, but it may not justify the additional complexity.

Production build 0.69.0 2024