Steps to reproduce:
1. Open ctools modal popup several times on the same page (without reloading)
2. Close popup via escape key
3. The subsequent close event (CToolsDetachBehaviors) will be triggered multiple times (one time per each newly opened popup).

It caused by the fact that each time when we call Drupal.CTools.Modal.modalContent() we bind new event, and it does not unbind-ed sufficiently on close event.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IRuslan created an issue. See original summary.

IRuslan’s picture

Status: Needs work » Needs review
FileSize
1.01 KB
Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 2 year old patch to modal.js does not apply to the latest ctools 7.x-1.x-dev.

Checking patch js/modal.js...
error: while searching for:
      $('body').unbind( 'keypress', modalEventHandler );
      $('body').unbind( 'keydown', modalTabTrapHandler );
      $('.close').unbind('click', modalContentClose);
      $('body').unbind('keypress', modalEventEscapeCloseHandler);
      $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));

      // Set our animation parameters and use them

error: patch failed: js/modal.js:587
error: js/modal.js: patch does not apply
AkashKumar07’s picture

Status: Needs work » Needs review
FileSize
581 bytes

Reroll of #2.

joelpittet’s picture

Status: Needs review » Fixed
Issue tags: -Needs reroll

I noticed the event is different from when it was bound as well so changed that on commit. Thanks @IRuslan

Status: Fixed » Closed (fixed)

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