Unable to unbind modalTabTrapHandler

Created on 18 September 2023, over 1 year ago
Updated 12 August 2024, 4 months ago

Problem/Motivation

The modalTabTrapHandler() is not a method of Drupal.CTools.Modal.modalContent and is not unbindable from other js files. There might be a case when we want to have a custom trap handler solution for ctools modals and unbind the modalTabTrapHandler when the modal opens.

Calling $('body').unbind('keydown', Drupal.CTools.Modal.modalContent.modalTabTrapHandler); surely works but only because unbinding an undefined unbinds everything, but we should fix it by defining the modalTabTrapHandler as a method of Drupal.CTools.Modal.

Steps to reproduce

- Open a ctools modal
- From a different custom module call $('body').unbind('keydown', Drupal.CTools.Modal.modalContent.modalTabTrapHandler);
- Notice that all keydown functions are unbinded, but we only want to unbind the modalTabTrapHandler function

Proposed resolution

Move modalTabTrapHandler out of modalContent.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇸🇮Slovenia sasanikolic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024