After going into the IPE on a panel node and clicking "Cancel", the contextual links for the panes no longer work (seems javascript-related). Other contextual links on the page still work normally.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

floretan’s picture

When the "Cancel" or "Save" button is pressed, the panes are rebuilt using ajax. The problem with the contextual links is that they use a "destination" parameter to point back to the current page, but that in this case the "current page" is the ajax callback and not the page where the pane has been inserted.

mcarbone’s picture

Version: 7.x-3.2 » 7.x-3.x-dev

Confirmed on dev. An easy way to reproduce in a sandbox is to simply add the "Who's Online" block and even before saving the contextual "Configure Block" link has the ajax callback as the destination parameter.

David_Rothstein’s picture

Title: Contextual links for panes don't work after clicking "Cancel" in IPE » Contextual links and other JavaScript behaviors on panes don't work after clicking "Cancel" in IPE
Status: Active » Needs review
FileSize
5.16 KB

It actually sounds like there are two different bugs being reported here:

  1. The last couple of comments refer to a bug that happens with newly added panes (e.g., if you just added the "Who's Online" block). A possible solution for that would be to have the Ajax callback fake the correct value of $_GET['q'] before rendering the pane (similar to what menu_set_active_item() does)...
  2. The original bug report sounds different, though. To reproduce that, start with a situation where the "Who's Online" block is already on the page. Then open the IPE and hit "Cancel". At this point, the contextual links won't work at all (i.e., nothing even happens when you click on them - there is no JavaScript behavior attached).

Both bugs happen for more than just contextual links, although contextual links are the easiest way to experience them.

The attached patch deals with #2. It's a pretty complicated bug, so I tried to explain in the inline code comments what I think is going on.

Perhaps we should split #1 to a different issue. (See also: some of the comments at #1520492: Saving a change in the IPE results in a blank page, fine after refresh, no error.)

David_Rothstein’s picture

The last couple of comments refer to a bug that happens with newly added panes (e.g., if you just added the "Who's Online" block).

Actually, slight correction: it's not just newly-added panes, but also occurs for any pane, provided you just clicked the "Save" button.

So the main difference between the two bugs reported here is that one happens on save/add, and the other happens on cancel.

merlinofchaos’s picture

Status: Needs review » Needs work

Unfortunately, changes made recently make this patch not apply. Can i get a reroll?

ordermind’s picture

Status: Needs work » Closed (fixed)

I just checked the latest dev, the problem seems to have been resolved elsewhere so I'm closing this.

ordermind’s picture

Status: Closed (fixed) » Active

My mistake, a related issue was fixed but not this one. Contextual links still don't work after clicking "Cancel".

David_Rothstein’s picture

Status: Active » Needs work

Yup, this still occurs. Let me see if it's possible to do a quick reroll to get the patch working again.

David_Rothstein’s picture

Status: Needs work » Needs review
FileSize
5.18 KB

Alright, the reroll was pretty trivial, and testing against the latest 7.x-3.x-dev it seems to work for me.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Just experienced the same problem, the patch works great and the added documentation is impeccable.

gmclelland’s picture

I can confirm that the patch in #9 worked for me.

japerry’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Confirmed issue, tested patch. committed.

http://drupalcode.org/project/panels.git/commit/ed2063d

gmclelland’s picture

japerry’s picture

Status: Fixed » Needs work

I had to revert this issue because of errors in Firefox. When this patch is applied, in some cases it can cause the browser to grind to a halt.

Revert here: http://drupalcode.org/project/panels.git/commit/c88c0aa

You can easily reproduce this with a stock commons install and this patch. Just click the IPE, click around inside panels a bit, and click cancel. You'll see the IPE menu disappears and firefox will become very slow.

  • Commit c88c0aa on 7.x-3.x, 8.x-3.x by japerry:
    Revert "Issue #1621014 by David_Rothstein: Contextual links and other...
  • Commit ed2063d on 7.x-3.x, 8.x-3.x authored by David_Rothstein, committed by japerry:
    Issue #1621014 by David_Rothstein: Contextual links and other JavaScript...
rafenden’s picture

Just tested Panels with revision ed2063d46b61502707cf09c976a93cf1ef938412 and they worked well in Firefox 35.0.1.

milodesc’s picture

Re-rolled for Panels 3.6.

awakash’s picture

Updated this patch for Panels 7.x-3.7

joelstein’s picture

The patch in #18 works for me. I also tested with Firefox 42, 47, and 49.0.2, which worked with no problems. I haven't tested Firefox with Commons, per #14.

joelstein’s picture

Updated patch to apply cleanly with new Panels release.

  • japerry committed c88c0aa on 8.x-4.x
    Revert "Issue #1621014 by David_Rothstein: Contextual links and other...
  • japerry committed ed2063d on 8.x-4.x authored by David_Rothstein
    Issue #1621014 by David_Rothstein: Contextual links and other JavaScript...