From 2cd58efcddc08e8914e74d50bc2522ae3e4cdeb9 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Wed, 15 May 2019 16:37:06 +0530 Subject: [PATCH] 1) Fixed Tab key navigation for Maintenance dialog. Fixes #4227 2) Fix Tab key issue for Toggle switch controls and button on the dialog footer in Safari browser. Fixes #4244 --- docs/en_US/release_notes_4_7.rst | 2 ++ web/pgadmin/browser/static/js/collection.js | 6 ++--- web/pgadmin/browser/static/js/node.js | 6 ++--- web/pgadmin/static/js/backform.pgadmin.js | 3 ++- web/pgadmin/static/js/utils.js | 13 ++++++++-- .../import_export/static/js/import_export.js | 7 ++++-- .../maintenance/static/js/maintenance.js | 25 ++++++++++++------- 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/docs/en_US/release_notes_4_7.rst b/docs/en_US/release_notes_4_7.rst index 1bc0ce766..86ebeceb9 100644 --- a/docs/en_US/release_notes_4_7.rst +++ b/docs/en_US/release_notes_4_7.rst @@ -18,5 +18,7 @@ Bug fixes | `Bug #4194 `_ - Fix accessibility issue for menu navigation. | `Bug #4218 `_ - Properly assign dropdownParent in Select2 controls. | `Bug #4219 `_ - Ensure popper.js is installed when needed. +| `Bug #4227 `_ - Fixed Tab key navigation for Maintenance dialog. +| `Bug #4244 `_ - Fix Tab key issue for Toggle switch controls and button on the dialog footer in Safari browser. | `Bug #4246 `_ - Fixed console error when subnode control is used in panels. | `Bug #4261 `_ - Stop using application/x-javascript as a mime type and use the RFC-compliant application/javascript instead. \ No newline at end of file diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js index 483f57b71..0549ebc98 100644 --- a/web/pgadmin/browser/static/js/collection.js +++ b/web/pgadmin/browser/static/js/collection.js @@ -93,12 +93,10 @@ define([ // All buttons will be created within a single // div area. var btnGroup = - $('
').addClass( - 'pg-prop-btn-group' - ), + $('
'), // Template used for creating a button tmpl = _.template([ - '', diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index 10427f0e0..278a7ddc2 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -1092,12 +1092,10 @@ define('pgadmin.browser.node', [ // All buttons will be created within a single // div area. var btnGroup = - $('
').addClass( - 'pg-prop-btn-group' - ), + $('
'), // Template used for creating a button tmpl = _.template([ - '', diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index 5db18cf38..2a8792b2b 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -444,7 +444,7 @@ define([ template: _.template([ '', '
', - ' 0) { @@ -69,4 +78,4 @@ export function getGCD(inp_arr) { } return result; -} \ No newline at end of file +} diff --git a/web/pgadmin/tools/import_export/static/js/import_export.js b/web/pgadmin/tools/import_export/static/js/import_export.js index 4fbdf882c..74499d11b 100644 --- a/web/pgadmin/tools/import_export/static/js/import_export.js +++ b/web/pgadmin/tools/import_export/static/js/import_export.js @@ -591,6 +591,11 @@ define([ break; } }, + + onshow: function() { + var container = $(this.elements.body).find('.tab-content:first > .tab-pane.active:first'); + commonUtils.findAndSetFocus(container); + }, }, prepare: function() { @@ -656,8 +661,6 @@ define([ }); view.$el.attr('tabindex', -1); - var container = view.$el.find('.tab-content:first > .tab-pane.active:first'); - commonUtils.findAndSetFocus(container); setTimeout(function() { pgBrowser.keyboardNavigation.getDialogTabNavigator($(self.elements.dialog)); }, 200); diff --git a/web/pgadmin/tools/maintenance/static/js/maintenance.js b/web/pgadmin/tools/maintenance/static/js/maintenance.js index 4d696c31d..2311b506e 100644 --- a/web/pgadmin/tools/maintenance/static/js/maintenance.js +++ b/web/pgadmin/tools/maintenance/static/js/maintenance.js @@ -76,18 +76,24 @@ define([ '
', ' <% for (var i=0; i < options.length; i++) { %>', ' <% var option = options[i]; %>', - '
', ].join('\n')), + render: function() { + Backform.RadioControl.prototype.render.apply(this, arguments); + this.$el.find('.pg-maintenance-op .btn').on('keyup', (e)=>{ + switch(e.keyCode) { + case 32: /* Spacebar click */ + $(e.currentTarget).trigger('click'); + break; + } + }); + return this; + }, }), - select2: { - allowClear: false, - width: '100%', - placeholder: gettext('Select from list...'), - }, }, { type: 'nested', @@ -423,6 +429,10 @@ define([ }); } }, + onshow: function() { + var container = $(this.elements.body).find('.tab-content:first > .tab-pane.active:first'); + commonUtils.findAndSetFocus(container); + }, }, prepare: function() { // Main maintenance tool dialog container @@ -466,9 +476,6 @@ define([ } view.$el.attr('tabindex', -1); - var container = view.$el.find('.tab-content:first > .tab-pane.active:first'); - commonUtils.findAndSetFocus(container); - this.elements.content.appendChild($container.get(0)); }, };