Right click should not submit buttons with Ajax behaviors

Created on 16 November 2015, over 8 years ago
Updated 24 June 2024, 1 day ago

Problem/Motivation

Currently, the Drupal ajax framework uses mousedown to capture the click even for triggering ajax. This causes some usability problems because it means mouse interactions trigger the ajax event. This is also a accessibility problem because it
violates WCAG 2.1 https://www.w3.org/TR/WCAG21/#pointer-cancellation

Steps to reproduce

  1. Install Drupal 10
  2. Add a file field to articles. Set Allowed number of values to Unlimited
  3. Create an article. Add several files to it.
  4. Right click on the remove button and see the file be removed.

Proposed resolution

Replace mousdown with click event handlers.

Remaining tasks

Review and commit.

User interface changes

API changes

Data model changes

Release notes snippet

Original report by @mibfire

I have noticed that when #ajax is attached to a submit button the right click(and all other buttons of mouse, like middle) is working as well and i dont think it should. It is because the ajax.js uses the mousedown event in default. I would like to know if there is some reason for using mousedown because i think this should work only with (left)click. THX

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Ajax 

Last updated about 4 hours ago

Created by

🇭🇺Hungary mibfire

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

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.69.0 2024