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 all 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
- Install Drupal 10
- Add a file field to articles. Set Allowed number of values to Unlimited
- Create an article. Add several files to it.
- 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