diff --git a/web/pgadmin/static/bundle/codemirror.js b/web/pgadmin/static/bundle/codemirror.js
index deecca1..ed9d0a6 100644
--- a/web/pgadmin/static/bundle/codemirror.js
+++ b/web/pgadmin/static/bundle/codemirror.js
@@ -36,6 +36,23 @@ cmds.focusOut = function(){
   }
 };
 
-CodeMirror.keyMap.default['Esc'] = 'focusOut';
+CodeMirror.defineInitHook(function (codeMirror) {
+  codeMirror.addKeyMap({
+    Tab: function (cm) {
+      if(cm.somethingSelected()){
+        cm.execCommand('indentMore');
+      }
+      else {
+        if (cm.getOption('indentWithTabs')) {
+          cm.replaceSelection('\t', 'end', '+input');
+        }
+        else {
+          cm.execCommand('insertSoftTab');
+        }
+      }
+    },
+  });
+});
 
+CodeMirror.keyMap.default['Esc'] = 'focusOut';
 export default CodeMirror;
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index dce683d..9a259c6 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -2527,22 +2527,6 @@ define([
         self.sqlCtrl.setOption('lineWrapping', sqlEditPreferences.wrap_code);
         self.sqlCtrl.setOption('autoCloseBrackets', sqlEditPreferences.insert_pair_brackets);
         self.sqlCtrl.setOption('matchBrackets', sqlEditPreferences.brace_matching);
-        // Added extra logic to handel tab indent and use space setting.
-        self.sqlCtrl.setOption('extraKeys', {
-          Tab: (cm) => {
-            if(cm.somethingSelected()){
-              cm.execCommand('indentMore');
-            } else {
-              if (!sqlEditPreferences.use_spaces) {
-                cm.replaceSelection('\t', 'end', '+input');
-              }
-              else {
-                cm.execCommand('insertSoftTab');
-              }
-            }
-          },
-          'Shift-Tab': (cm) => cm.execCommand('indentLess'),
-        });
         setTimeout(function() {
           if (self.sqlCtrl) self.sqlCtrl.refresh();
         }, 500);
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
index 676df7a..5a3d155 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
@@ -224,22 +224,6 @@ function updateUIPreferences(sqlEditor) {
   sqlEditor.query_tool_obj.setOption('lineWrapping', preferences.wrap_code);
   sqlEditor.query_tool_obj.setOption('autoCloseBrackets', preferences.insert_pair_brackets);
   sqlEditor.query_tool_obj.setOption('matchBrackets', preferences.brace_matching);
-  // Added extra logic to handel tab indent and use space setting.
-  sqlEditor.query_tool_obj.setOption('extraKeys', {
-    Tab: (cm) => {
-      if(cm.somethingSelected()){
-        cm.execCommand('indentMore');
-      } else {
-        if (!preferences.use_spaces) {
-          cm.replaceSelection('\t', 'end', '+input');
-        }
-        else {
-          cm.execCommand('insertSoftTab');
-        }
-      }
-    },
-    'Shift-Tab': (cm) => cm.execCommand('indentLess'),
-  });
   sqlEditor.query_tool_obj.refresh();
 
   /* Render history to reflect Font size change */
diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js
index 914ac4f..04a2b46 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_data.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_data.js
@@ -200,22 +200,6 @@ function initFilterDialog(alertify, pgBrowser) {
           $(this.filter_obj.getWrapperElement()).css('font-size', sql_font_size);
 
           setTimeout(function() {
-            // Added extra logic to handel tab indent and use space setting.
-            that.filter_obj.setOption('extraKeys', {
-              Tab: (cm) => {
-                if(cm.somethingSelected()){
-                  cm.execCommand('indentMore');
-                } else {
-                  if (!that.preferences.use_spaces) {
-                    cm.replaceSelection('\t', 'end', '+input');
-                  }
-                  else {
-                    cm.execCommand('insertSoftTab');
-                  }
-                }
-              },
-              'Shift-Tab': (cm) => cm.execCommand('indentLess'),
-            });
             // Set focus on editor
             that.filter_obj.refresh();
             that.filter_obj.focus();
