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 #2805227: Make sure Place Block buttons identify as buttons in Block layout UI.. 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.

Comments

GaëlG created an issue. See original summary.

GaëlG’s picture

Issue summary: View changes
GaëlG’s picture

Issue summary: View changes
GaëlG’s picture

I ran a file search to find the "pseudo-buttons":

  1. The "Place block" button in /admin/structure/block (it's discussed in #2805227: Make sure Place Block buttons identify as buttons in Block layout UI.)
  2. In many places in the CKeditor core module (search for role="button")
  3. In quickedit.js (what for?)
  4. For the toolbar items (ToolbarItem.php)

There are also places where the "button" role is set on elements other than anchor (div, fieldset, etc.) but I don't know if this is also a problem.

GaëlG’s picture

GaëlG’s picture

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.