Closing the shortcuts bar destroys the overlay. Opening it has the same effect.

Steps to reproduce:

1) Click a link that opens an overlay (e.g. "Create content" or any administration link)
2) Close the shortcuts bar (click on the little arrow at the right of the toolbar)

See the overlay vanish, possibly with unsaved content that has been entered.

I filed it on overlay.module but could also be a shortcuts.module or toolbar.module issue, I don't know.

CommentFileSizeAuthor
#2 Overlay-toolbar-compat.patch1.5 KBGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

I was immediately about to say this is an issue with toolbar, since it reloads the page with the link. However, without the overlay, it indeed does not reload the page, so it is a problem with the overlay interaction for sure.

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
1.5 KB

Ok, the issue here is that we have two click handlers. One in overlay-parent.js:

    // Simulate the native click event for all links that appear outside the
    // overlay. jQuery UI Dialog prevents all clicks outside a modal dialog.
    $('.overlay-displace-top a', context)
    .add('.overlay-displace-bottom a', context)
    .click(function () {
      window.location.href = this.href;
    });

The other in toolbar.js:

    // Toggling toolbar drawer.
    $('#toolbar a.toggle', context).once('toolbar-toggle').click(function() {
      Drupal.admin.toolbar.toggle();
      return false;
    });

Unfortunately the first runs before the second, so the reload is already started by the time the toolbar can start toggling and trying to stop the event flow. It cannot stop the event that started earlier obviously.

We have a few options to fix this:

- get the toolbar.js run before overlay-parent.js (can be a fragile solution)
- come up with a name and add a class on the toggle link to exclude it from the displace click simulation
- somehow delay that redirect and wait for whether someone else handles the link (sounds bloated)

I picked the second idea I had and put in a preprocess chunk to add a class by the overlay and then skip links with that class in the click handler. Obviously if the toolbar is replaced with something else having similar controls in the toolbar or any bottom bar, they'd need to add this class for similar click-hook links.

With this patch, the toolbar works fine with me with the overlay.

roborn’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed. The toolbar + overlay works fine with this patch.
Tested on FF3.5 and Chrome3.

mcrittenden’s picture

Sub.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

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