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

Created on 30 September 2016, over 7 years ago
Updated 12 September 2023, 10 months 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 about 2 hours 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.

  • 🇨🇦Canada mgifford Ottawa, Ontario

    Might be worth evaluating if this is still a problem. This may have been a browser issue not providing sufficient support at the time. Maybe ARIA is better supported to work well with the space bar in 2023.

  • Status changed to Needs review 10 months ago
  • last update 10 months ago
    30,148 pass
  • 🇮🇳India Gauravvv Delhi, India

    This is still happening. I have created a patch for same. please review.

  • Status changed to Needs work 10 months ago
  • 🇺🇸United States smustgrave

    Issue summary should be updated.

    Also will need a test case believe.

Production build 0.69.0 2024