Currently in the process of updating a modal from Bootstrap 3 to Bootstrap 4. One particular issue I encountered involves the modification of the backdrop and keyboard options for an open modal. In Bootstrap 3, I successfully achieved this by executing:
$('.modal').data('bs.modal').options.backdrop = newBackdropValue;
$('.modal').data('bs.modal').options.keyboard = newKeyboardValue;
However, upon transitioning to Bootstrap 4, the error message indicating that options
was undefined popped up. As a solution, I attempted to utilize _config
, where these options appear to be stored now, but unfortunately, it didn't alter the modal's behavior.
Upon examining the Bootstrap 4 code, I observed that the _setEscapeEvent
function is triggered on show, which appears to add a listener for the keyboard events. Despite this, I couldn't locate any public functions responsible for removing this listener.
If anyone has experience dealing with this issue or insights on how to address it without resorting to private methods on the Modal, your guidance would be greatly appreciated.