Toolbar buttons should respond to spacebar key

Created on 4 October 2019, about 5 years ago
Updated 18 May 2023, over 1 year ago

Spin-off from #3066954: Admin toolbar not usable with latest versions of JAWS due to mis-use of aria-owns .

Problem/Motivation

Buttons don't respond to the spacebar key. These are faux buttons (<a href="" role="button">) which only respond to the return key. Can be replicated in Firefox and Chrome.

These are reported as buttons to assistive tech. Screen readers will announce them as buttons, and include them in the list-of-buttons tool. A role is a promise which sets user expectations of how the button can be operated.

Proposed resolution

Add a keyboard handler to the <a href="" role="button"> so it responds to the spacebar key.

Note, the <button> is normally preferred for a disclosure control such as this. However when JS doesn't run, these top-level links are still present and work as basic links to /admin, /user, and /admin/config/user-interface/shortcut. They are links, which are progressively enhanced to buttons; it's appropriate to use <a role="button"> for this. We just need to complete the expected behaviour of a button.

Remaining tasks

  • Update toolbar JS.
  • Tests - simulate a keypress in a FunctionalJavascript or Nightwatch test, and confirm the toolbar tray is visible/hidden. Repeat for both the spacebar and return key.
🐛 Bug report
Status

Needs work

Version

10.1

Component
Toolbar 

Last updated 9 days 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.

  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024