Problem/Motivation

The openDialog ajax command moves dialog buttons to buttons area and binds a click event to them. When clicked, the dialog simulates mouse events on the original dialog buttons. The order of events is mousedown, click, mouseup:

          'click': function (e) {
            $originalButton.trigger('mousedown').trigger('click').trigger('mouseup');
            e.preventDefault();
          }

At least on my machine, clicking a form submit button fires these events in the following order: mousedown, mouseup, click.

Proposed resolution

Change the order of events to mousedown, mouseup, click.

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
dialog-ajax-click.patch598 bytesolli
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Mouseup is used in tabledrag and views. Both time it's the only event of the three (listed) so reordering them isn't a problem. Both tabledrag and views still work as expected.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

If you do a single mouse click of the left mouse botton, every modern browser I've checked does exactly the same thing. When the mouse goes down, a mousedown event is triggered. When the mouse goes back up, first a mouseup event and then a click event is triggered. Very nice.

From http://unixpapa.com/js/mouse.html.

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 8fa3288 and pushed to 8.0.x. Thanks!

  • alexpott committed 8fa3288 on 8.0.x
    Issue #2500723 by olli: Ajax dialog triggers click before mouseup
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.