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.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 2809347-22.patch | 771 bytes | gauravvvv |
Issue fork drupal-2809347
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
gaëlgComment #3
gaëlgComment #4
gaëlgI ran a file search to find the "pseudo-buttons":
role="button")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.
Comment #5
gaëlgComment #6
gaëlgComment #9
mgiffordJust adding some related links:
Comment #21
mgiffordMight 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.
Comment #22
gauravvvv commentedThis is still happening. I have created a patch for same. please review.
Comment #23
smustgrave commentedIssue summary should be updated.
Also will need a test case believe.