All links using the "button" role should respond to spacebar, not only to enter key

Created on 30 September 2016, about 8 years ago
Updated 12 September 2023, over 1 year ago

There are many places in core where a link with the "button" role is used (a[role=button]). The expected behavior of such an element is that it responds to the spacebar (and obviously to the enter key and to click). For now, most of the time, it does not respond to the spacebar, which is an accessibility problem.

It's easy to add some JS code to give all "pseudo-buttons" the intended behavior. But we want to make sure this won't break anything.

The first thing to do might be to detect where it's used in core, and where adding the correct behavior could break the UI.

Additional info:
This is a follow-up of 🐛 Make sure Place Block buttons identify as buttons in Block layout UI. Postponed . We had a discussion with andrewmacpherson at DrupalCon Dublin about this. We thought it would be nice to open this wider issue. Screenreaders tell the users that <a role='button'> is a button, so the users expect the spacebar to respond.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Javascript 

Last updated 1 day ago

Created by

🇫🇷France GaëlG Lille, France

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 issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • 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

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