mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed tab key navigation issue for Grant Wizard. Fixes #5241
1) Added entry for .scss to change the shadow of 'ajs-close' button. 2) allow the user to use the keyboard to update the Backgrid cell DateTime picker control.
This commit is contained in:
committed by
Akshay Joshi
parent
e6118a06e8
commit
13b65c9a6a
@@ -155,6 +155,7 @@ define([
|
||||
'click button.wizard-finish': 'finishWizard',
|
||||
'click button.wizard-help': 'onDialogHelp',
|
||||
'click a.close-error': 'closeErrorMsg',
|
||||
'keydown': 'keydownHandler',
|
||||
},
|
||||
initialize: function(options) {
|
||||
this.options = _.extend({}, this.options, options.options);
|
||||
@@ -239,6 +240,60 @@ define([
|
||||
delete this.el; // Delete the variable reference to this node
|
||||
return true;
|
||||
},
|
||||
keydownHandler: function(event) {
|
||||
let wizardHeader = $(event.currentTarget).find('.wizard-header');
|
||||
let wizardFooter = $(event.currentTarget).find('.wizard-footer');
|
||||
let gridElement = $(event.currentTarget).find('.select-row-cell:first');
|
||||
let gridElementLast = $(event.currentTarget).find('.select-row-cell:last');
|
||||
|
||||
let firstWizardHeaderButton = $(wizardHeader).find('button:enabled:first');
|
||||
let lastWizardHeaderButton = $(wizardHeader).find('button:enabled:last');
|
||||
let lastWizardFooterBtn = $(wizardFooter).find('button:enabled:last');
|
||||
let firstWizardFooterBtn = $(wizardFooter).find('button:enabled:first');
|
||||
|
||||
|
||||
if (event.shiftKey && event.keyCode === 9) {
|
||||
// Move backwards
|
||||
if(firstWizardHeaderButton && $(firstWizardHeaderButton).is($(event.target))) {
|
||||
if (lastWizardFooterBtn) {
|
||||
$(lastWizardFooterBtn).focus();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
else if ($(firstWizardFooterBtn).is($(event.target))){
|
||||
if ($(gridElement).find('.custom-control-input').is(':visible')){
|
||||
$(gridElementLast).find('.custom-control-input').focus();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}else if ($(event.currentTarget).find('.wizard-content').find('.CodeMirror-scroll').is(':visible')){
|
||||
$(lastWizardHeaderButton).focus();
|
||||
}
|
||||
}
|
||||
} else if (event.keyCode === 9) {
|
||||
// Move forwards
|
||||
// If taget is last button then goto first element
|
||||
if(lastWizardFooterBtn && $(lastWizardFooterBtn).is($(event.target))) {
|
||||
$(firstWizardHeaderButton).focus();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}else if (event.target.innerText == 'Name'){
|
||||
if ($(gridElement).find('.custom-control-input').is(':visible')){
|
||||
$(gridElement).find('.custom-control-input').focus();
|
||||
}else {
|
||||
$(firstWizardFooterBtn).focus();
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else if(event.target.tagName == 'DIV') {
|
||||
$(event.currentTarget).find('.custom-control-input:first').trigger('focus');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else if(event.target.tagName == 'TEXTAREA'){
|
||||
$(firstWizardFooterBtn).focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
enableDisableNext: function(disable) {
|
||||
if (typeof(disable) != 'undefined') {
|
||||
this.options.disable_next = disable;
|
||||
|
||||
Reference in New Issue
Block a user