diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js
index 3068572d1..c696c8046 100644
--- a/web/pgadmin/browser/static/js/wizard.js
+++ b/web/pgadmin/browser/static/js/wizard.js
@@ -292,6 +292,9 @@ define([
         } else if(event.target.tagName == 'TEXTAREA'){
           $(firstWizardFooterBtn).focus();
         }
+      } else if (event.keyCode === 27){
+        //close the wizard when esc key is pressed
+        $(wizardHeader).find('button.ajs-close').click();
       }
     },
     enableDisableNext: function(disable) {
diff --git a/web/pgadmin/static/js/utils.js b/web/pgadmin/static/js/utils.js
index 86dae698e..2ddae874d 100644
--- a/web/pgadmin/static/js/utils.js
+++ b/web/pgadmin/static/js/utils.js
@@ -38,7 +38,8 @@ export function findAndSetFocus(container) {
           .pgadmin-controls:first input:enabled,
           .pgadmin-controls:first .btn:not(.toggle),
           .ajs-commands:first,
-          .CodeMirror-scroll`)
+          .CodeMirror-scroll,
+          .wizard-header`)
         .find('*[tabindex]:not([tabindex="-1"])');
     }
 
