Ensure that the grant wizard should be closed on pressing the ESC key. Fixes #4206

This commit is contained in:
Pradip Parkale
2020-04-07 13:48:56 +05:30
committed by Akshay Joshi
parent d6bc3ccc8b
commit 33deacacee
5 changed files with 8 additions and 14 deletions

View File

@@ -184,11 +184,10 @@ define([
/* OnLoad Callback */
this.onLoad();
setTimeout(function() {
var container = $(self.el);
commonUtils.findAndSetFocus(container);
}, 100);
}, 500);
return this;
},
@@ -292,6 +291,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) {

View File

@@ -39,10 +39,10 @@ export function findAndSetFocus(container) {
.pgadmin-controls:first .btn:not(.toggle),
.pgadmin-controls:first,
.ajs-commands:first,
.CodeMirror-scroll`)
.find('*[tabindex]:not([tabindex="-1"])');
.CodeMirror-scroll,
.pgadmin-wizard`)
.find('*[tabindex]:not([tabindex="-1"]),input:enabled');
}
if(first_el.length > 0) {
first_el[0].focus();
} else {

View File

@@ -95,10 +95,6 @@
onKeydown: function (e) {
var command = new Backgrid.Command(e);
if (command.passThru()) return true; // skip ahead to `change`
if (command.cancel()) {
e.stopPropagation();
this.checkbox().blur();
}
else if (command.save() || command.moveLeft() || command.moveRight() ||
command.moveUp() || command.moveDown()) {

View File

@@ -428,11 +428,6 @@ define([
});
},
hooks: {
onshow: function() {
commonUtils.findAndSetFocus($(this.elements.body));
},
},
prepare: function() {
var that = this;