public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin][RM5371] : Tab key navigation is not working in some of the dialogs
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin][RM5371] : Tab key navigation is not working in some of the dialogs
@ 2020-04-13 12:18  Pradip Parkale <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Pradip Parkale @ 2020-04-13 12:18 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Please find the attached path. I have fixed tab key navigation in some of
the dialogs.

This patch includes the fixes for:

1 Login/Group roles >> Group parameter
2 Table space >> Security >> Privileges
3 Foreign data wrapper >> Security
4 Languages >> Security
5 Foreign table >> columns. 2 >> security
6 Function >> Security.
7 MV >> Security.
8 Table >> Security
9 Trigger Function >> Security
10 View >> Security
11 Types >> Security
12 Procedure  >> Security


Please review.



-- 
Thanks & Regards,
Pradip Parkale
QMG, EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM5371.patch (10.9K, 3-RM5371.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
index 94a4de721..569b16c07 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
@@ -8,8 +8,8 @@
 //////////////////////////////////////////////////////////////
 
 define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
-  'backgrid', 'alertify', 'pgadmin.browser.node', 'pgadmin.browser.node.ui',
-], function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgNode) {
+  'backgrid', 'alertify', 'pgadmin.browser.node', 'sources/utils', 'pgadmin.browser.node.ui',
+], function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgNode, commonUtils) {
   /**
    * Each Privilege, supporeted by an database object, will be represented
    * using this Model.
@@ -622,11 +622,16 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
           command = new Backgrid.Command(ev),
           coll = this.model.get(this.column.get('name'));
 
+        if (ev.key == 'Tab'){
+          commonUtils.handleKeyNavigation(event);
+        }
+
         if (command.moveUp() || command.moveDown() || command.save()) {
           // backgrid vertical navigation (Up/Down arrow key)
           ev.preventDefault();
           ev.stopPropagation();
-          model.trigger('backgrid:edited', model, column, command);
+          this.model.trigger('backgrid:edited', this.model, this.column, command);
+          // model.trigger('backgrid:edited', model, column, command);
           return;
         }
         // esc
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 5d3d341cd..5211a8078 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -1555,7 +1555,7 @@ define('pgadmin.browser.node', [
               }
               let btnGroup = $(panel.$container.find('.pg-prop-btn-group'));
               let el = $(btnGroup).find('button:first');
-              if (panel.$container.find('td.editable:last').is(':visible')){
+              if (panel.$container.find('.number-cell.editable:last').is(':visible')){
                 if (event.keyCode === 9 && event.shiftKey) {
                   if ($(el).is($(event.target))){
                     $(panel.$container.find('td.editable:last').trigger('click'));
diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js
index 080ae56f2..408b4fff8 100644
--- a/web/pgadmin/browser/static/js/wizard.js
+++ b/web/pgadmin/browser/static/js/wizard.js
@@ -240,61 +240,7 @@ define([
       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();
-        }
-      } else if (event.keyCode === 27){
-        //close the wizard when esc key is pressed
-        $(wizardHeader).find('button.ajs-close').click();
-      }
+      commonUtils.handleKeyNavigation(event);
     },
     enableDisableNext: function(disable) {
       if (typeof(disable) != 'undefined') {
diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html
index f8b3d5764..0bf9f4245 100644
--- a/web/pgadmin/browser/templates/browser/index.html
+++ b/web/pgadmin/browser/templates/browser/index.html
@@ -123,7 +123,7 @@ window.onload = function(e){
             <li id="mnu_management" class="nav-item active dropdown d-none">
                 <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{
                     _('Management') }} <span class="caret"></span></a>
-                <ul class="dropdown-menu" role="menu"></ul>
+                <ul class="dropdown-menu" aria-hidden="true"></ul>
             </li>
             <li id="mnu_tools" class="nav-item active dropdown d-none">
                 <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 08f078d60..e8133a9ff 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1822,6 +1822,7 @@ define([
 
       /* Check for sql editor preference changes */
       let self = this;
+      this.$el.find('textarea').attr('tabindex', -1);
       pgBrowser.onPreferencesChange('sqleditor', function() {
         self.reflectPreferences();
       });
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index 7729a02ee..e196efa0d 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -833,6 +833,12 @@ define([
         // go to Next Cell & if Shift is also pressed go to Previous Cell
         if (e.keyCode == 9 || e.keyCode == 16) {
           gotoCell = e.shiftKey ? self.$el.prev() : self.$el.next();
+          if (self.$el.next().length == 0){
+            setTimeout(function() {
+              self.$el.find('.select2-selection').blur();
+            }, 100);
+
+          }
         }
 
         if (gotoCell) {
diff --git a/web/pgadmin/static/js/utils.js b/web/pgadmin/static/js/utils.js
index de70dd2e5..b0c9165af 100644
--- a/web/pgadmin/static/js/utils.js
+++ b/web/pgadmin/static/js/utils.js
@@ -9,6 +9,8 @@
 
 import _ from 'underscore';
 import { getTreeNodeHierarchyFromIdentifier } from 'sources/tree/pgadmin_tree_node';
+import $ from 'jquery';
+
 
 export function parseShortcutValue(obj) {
   var shortcut = '';
@@ -19,6 +21,64 @@ export function parseShortcutValue(obj) {
   return shortcut;
 }
 
+export function handleKeyNavigation(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();
+    }
+  } else if (event.keyCode === 27){
+    //close the wizard when esc key is pressed
+    $(wizardHeader).find('button.ajs-close').click();
+  }
+}
+
 export function findAndSetFocus(container) {
   if (container.length == 0) {
     return;
diff --git a/web/pgadmin/static/vendor/backgrid/backgrid.js b/web/pgadmin/static/vendor/backgrid/backgrid.js
index 1a2b78d25..7a71354d8 100644
--- a/web/pgadmin/static/vendor/backgrid/backgrid.js
+++ b/web/pgadmin/static/vendor/backgrid/backgrid.js
@@ -987,6 +987,9 @@ var StringCell = Backgrid.StringCell = Cell.extend({
 
   /** @property */
   className: "string-cell",
+  attributes: {
+    tabIndex: "0"
+  },
 
   formatter: StringFormatter
 


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin][RM5371] : Tab key navigation is not working in some of the dialogs
@ 2020-04-14 08:03  Akshay Joshi <[email protected]>
  parent: Pradip Parkale <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2020-04-14 08:03 UTC (permalink / raw)
  To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Mon, Apr 13, 2020 at 5:48 PM Pradip Parkale <
[email protected]> wrote:

> Hi Hackers,
>
> Please find the attached path. I have fixed tab key navigation in some of
> the dialogs.
>
> This patch includes the fixes for:
>
> 1 Login/Group roles >> Group parameter
> 2 Table space >> Security >> Privileges
> 3 Foreign data wrapper >> Security
> 4 Languages >> Security
> 5 Foreign table >> columns. 2 >> security
> 6 Function >> Security.
> 7 MV >> Security.
> 8 Table >> Security
> 9 Trigger Function >> Security
> 10 View >> Security
> 11 Types >> Security
> 12 Procedure  >> Security
>
>
> Please review.
>
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> QMG, EnterpriseDB Corporation
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-04-14 08:03 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13 12:18 [pgAdmin][RM5371] : Tab key navigation is not working in some of the dialogs Pradip Parkale <[email protected]>
2020-04-14 08:03 ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox