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
This commit is contained in:
Aditya Toshniwal
2019-05-15 16:37:06 +05:30
committed by Akshay Joshi
parent ed8d1cde00
commit 2cd58efcdd
7 changed files with 40 additions and 22 deletions

View File

@@ -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);

View File

@@ -76,18 +76,24 @@ define([
'<div class="pgadmin-controls col-12 col-sm-8 btn-group pg-maintenance-op pgadmin-controls-radio-none" data-toggle="buttons">',
' <% for (var i=0; i < options.length; i++) { %>',
' <% var option = options[i]; %>',
' <label class="btn btn-primary<% if (i == 0) { %> active<%}%>">',
' <label class="btn btn-primary<% if (i == 0) { %> active<%}%>" tabindex="0">',
' <input type="radio" name="op" id="op" autocomplete="off" value=<%-formatter.fromRaw(option.value)%><% if (i == 0) { %> selected<%}%> > <%-option.label%>',
' </label>',
' <% } %>',
'</div>',
].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));
},
};