diff --git a/web/package.json b/web/package.json
index acfcb2efa..ba92e291b 100644
--- a/web/package.json
+++ b/web/package.json
@@ -51,7 +51,7 @@
   },
   "dependencies": {
     "acitree": "git+https://github.com/imsurinder90/jquery-aciTree.git#rc.7",
-    "alertifyjs": "1.7.1",
+    "alertifyjs": "git+https://github.com/EnterpriseDB/AlertifyJS/#72c1d794f5b6d4ec13a68d123c08f19021afe263",
     "axios": "^0.18.1",
     "babel-plugin-transform-es2015-modules-amd": "^6.24.1",
     "babel-preset-es2015-without-strict": "~0.0.4",
diff --git a/web/pgadmin/static/js/alertify/dialog_wrapper.js b/web/pgadmin/static/js/alertify/dialog_wrapper.js
index 83186e710..5346b6a0d 100644
--- a/web/pgadmin/static/js/alertify/dialog_wrapper.js
+++ b/web/pgadmin/static/js/alertify/dialog_wrapper.js
@@ -64,7 +64,7 @@ export class DialogWrapper {
     $(alertifyDialog.elements.footer).on('keydown', 'button', function(event) {
       if (event.keyCode == 9 && $(this).nextAll('button:not([disabled])').length == 0) {
         // set focus back to first editable input element of current active tab once we cycle through all enabled buttons.
-        commonUtils.findAndSetFocus($(alertifyDialog.elements.body).find('.tab-content div.active'));
+        commonUtils.findAndSetFocus($(alertifyDialog.elements.dialog));
         return false;
       }
     });
diff --git a/web/pgadmin/static/js/utils.js b/web/pgadmin/static/js/utils.js
index 9f9ef32c7..86dae698e 100644
--- a/web/pgadmin/static/js/utils.js
+++ b/web/pgadmin/static/js/utils.js
@@ -37,6 +37,7 @@ export function findAndSetFocus(container) {
         .find(`
           .pgadmin-controls:first input:enabled,
           .pgadmin-controls:first .btn:not(.toggle),
+          .ajs-commands:first,
           .CodeMirror-scroll`)
         .find('*[tabindex]:not([tabindex="-1"])');
     }
diff --git a/web/yarn.lock b/web/yarn.lock
index 26272668b..51334ccee 100644
--- a/web/yarn.lock
+++ b/web/yarn.lock
@@ -910,10 +910,9 @@ ajv@^6.1.0, ajv@^6.10.2, ajv@^6.9.1:
     json-schema-traverse "^0.4.1"
     uri-js "^4.2.2"
 
-alertifyjs@1.7.1:
+"alertifyjs@git+https://github.com/EnterpriseDB/AlertifyJS/#72c1d794f5b6d4ec13a68d123c08f19021afe263":
   version "1.7.1"
-  resolved "https://registry.yarnpkg.com/alertifyjs/-/alertifyjs-1.7.1.tgz#3c7b8ac67609aea737fe8e06d7fac885ce18ba8f"
-  integrity sha1-PHuKxnYJrqc3/o4G1/rIhc4Yuo8=
+  resolved "git+https://github.com/EnterpriseDB/AlertifyJS/#72c1d794f5b6d4ec13a68d123c08f19021afe263"
 
 alphanum-sort@^1.0.0:
   version "1.0.2"
