Problem

After invoke command ctools_modal_form_wrapper() on ajax response, Drupal attaches js behaviors for the whole document, instead of modal dialog. This causes duplicetes of ajax events for all selectors that uses context variable.

Example

$('.my-button', context).click(function() {
  console.log('I am invoked');
});

When page is loaded, click on this button will log only one message. But after modal dialog was invoked, the same click event will write in console two debug messages. After one more ajax response with modal dialog we will see three messages in console, etc.

Proposed solution

Add correct context for Drupal.attachBehaviors after modal context was invoked. Patch is attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spleshka’s picture

duozersk’s picture

Status: Needs review » Reviewed & tested by the community

Yup, looks pretty clear and straight forward fix to me.

Spleshka’s picture

Any progress here? Patch is almost obvious.

Spleshka’s picture

Still no progress? :(

podarok’s picture

Assigned: Unassigned » merlinofchaos

#1 looks good for me
let`s make it pushed

japerry’s picture

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

Status: Fixed » Closed (fixed)

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