In Firefox (but not in Chromium), right-clicking the close button closes the overlay.
That shouldn't be. Nobody expects that. It's not intuitive and not handy and not even consistent.

So, what's up there?
Neither Firefox nor Chromium fires the "click" event on clicking the right mouse button (button 2).
However, while Firefox at least fires both the "mouseup" and "mousedown" event, Chromium only fires the "mousedown" event.

However, overlay-parent.js currently expects :

Drupal.overlay.eventhandlerOverrideLink = function (event) {
  // In some browsers the click event isn't fired for right-clicks. Use the
  // mouseup event for right-clicks and the click event for everything else.
  if ((event.type === 'click' && event.button === 2) || (event.type === 'mouseup' && event.button !== 2)) {
    return;
  }

I'm not 100% sure, if there's any reason at all to act on the right mouse button in the overlay context. Certainly not for the close icon, and we're not defining custom context menus here, which would be the only candidate. But even then, we can only act on the right button's "mousedown" event for cross-browser-consistancy. But that again means that the click can't be cancelled by the user, limiting the application even more on custom context menus.

So, unless I missed a point, it seems right to discard the right button and only act on the 'click' event.

CommentFileSizeAuthor
#1 overlay-js.1967228-1.patch1.75 KBPancho
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pancho’s picture

FileSize
1.75 KB

Here's my proposal as a small patch:

Pancho’s picture

Status: Active » Needs review
MathieuSpil’s picture

Not only Firefox but also Opera shows this behaviour.
Tested the patch and worked as a charm (Firefox, Chrome, Safari, Opera & IE9)

The main question for me here is why was mouseUp added to listeners?
Also can't think of any use for the right-click.

nod_’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes
Status: Needs review » Needs work

Overlay is dead to D8 #2088121: Remove Overlay.

mimes’s picture

I've tested this in IE8, Chromium 28.0, and Firefox 25.0. Without the patch, all exhibit this behaviour.