From 616fe285faa6741faafa873c06f1450304ee4dfa Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 1 Oct 2019 12:38:43 -0400 Subject: [PATCH] Unbind keydown listeners when Alert modals are closed. This fixes a bug where attempting to hit enter in any sort of textarea would be ignored if the user had previously encountered an Alert modal while navigating throughout the application. --- awx/ui/client/src/shared/Utilities.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index c731a54bba..931553dac6 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -89,9 +89,11 @@ angular.module('Utilities', ['RestServices', 'Utilities']) scope.disableButtons2 = (disableButtons) ? true : false; $('#alert-modal2').on('hidden.bs.modal', function() { + $(document).unbind('keydown'); if (action) { action(); } + $('#alert-modal2').off(); }); $('#alert-modal2').on('shown.bs.modal', function() { $('#alert2_ok_btn').focus(); @@ -117,10 +119,12 @@ angular.module('Utilities', ['RestServices', 'Utilities']) }); $('#alert-modal').on('hidden.bs.modal', function() { + $(document).unbind('keydown'); if (action) { action(); } $('.modal-backdrop').remove(); + $('#alert-modal').off(); }); $('#alert-modal').on('shown.bs.modal', function() { $('#alert_ok_btn').focus();