From bc836aa37421a13ecb00fda907f34f4356c23803 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Mon, 29 Jan 2018 13:43:35 +0000 Subject: [PATCH] Ensure the user can use keyboard shortcuts after using button controls such as Cancel, Open and Save. Fixes #3054 --- web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 94151e77a..8b866174b 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -1539,6 +1539,7 @@ define('tools.querytool', [ function() { // Do nothing as user do not want to save, just continue self.query_tool_obj.setValue(''); + setTimeout(() => { self.query_tool_obj.focus(); }, 200); }, function() { return true; @@ -1568,6 +1569,7 @@ define('tools.querytool', [ if (self.history_collection) { self.history_collection.reset(); } + setTimeout(() => { self.query_tool_obj.focus(); }, 200); }, function() { return true; @@ -2805,6 +2807,7 @@ define('tools.querytool', [ // Update the flag as new content is just loaded. self.is_query_changed = false; + setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200); }, error: function(e) { var errmsg = $.parseJSON(e.responseText).errormsg; @@ -2845,6 +2848,7 @@ define('tools.querytool', [ // Update the flag as query is already saved. self.is_query_changed = false; + setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200); } self.trigger('pgadmin-sqleditor:loading-icon:hide'); if (self.close_on_save) { @@ -3556,6 +3560,8 @@ define('tools.querytool', [ self.disable_tool_buttons(false); alertify.alert(gettext('Cancel Query Error'), res.data.result); } + is_query_running = false; + setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200); }, error: function(e) { self.disable_tool_buttons(false);