Commit 83ff6971 authored by Jono Mingard's avatar Jono Mingard
Browse files

Use focus management in Edit access table (Bug #1262899)



Add buttons now set focus to the first input in the first added row.
These inputs have been given descriptive labels. Delete buttons set
focus to the entire table (or the table showing that no one has
access).

Change-Id: Ie04c46673395658b5d6a39b29306de456ae37d81
Signed-off-by: default avatarJono Mingard <jonom@catalyst.net.nz>
parent ad0c715c
......@@ -23,7 +23,7 @@
</fieldset>
</div>
<table id="accesslisttable" class="fr hidden fullwidth">
<table id="accesslisttable" class="fr hidden fullwidth hidefocus" tabindex="-1">
<thead>
<tr class="accesslist-head">
<th><span class="accessible-hidden">{{str tag=profileicon section=view}}</span></th>
......@@ -38,7 +38,7 @@
</tbody>
</table>
<table id="accesslisttabledefault" class="fr hidden fullwidth">
<table id="accesslisttabledefault" class="fr hidden fullwidth hidefocus" tabindex="-1">
<thead>
<tr class="accesslist-head">
<th>{{str tag=Added section=view}}</th>
......@@ -74,14 +74,19 @@ function renderPotentialPresetItem(item) {
if (item.type == 'allgroups') {
connect(addButton, 'onclick', function() {
var rows = [];
forEach(myGroups, function(g) {
appendChildNodes('accesslist', renderAccessListItem(g));
rows.push(renderAccessListItem(g));
});
if (rows.length > 0) {
getFirstElementByTagAndClassName('input', null, rows[0]).focus();
}
});
}
else {
connect(addButton, 'onclick', function() {
appendChildNodes('accesslist', renderAccessListItem(item));
var row = renderAccessListItem(item);
getFirstElementByTagAndClassName('input', null, row).focus();
});
}
appendChildNodes('potentialpresetitems', row);
......@@ -191,6 +196,10 @@ function renderAccessListItem(item) {
removeElement(row);
if (!getFirstElementByTagAndClassName('tr', null, 'accesslistitems')) {
renderAccessListDefault();
$('accesslisttabledefault').focus();
}
else {
$('accesslisttable').focus();
}
// Update the formchangechecker state
if (typeof formchangemanager !== 'undefined') {
......@@ -220,10 +229,16 @@ function renderAccessListItem(item) {
if (typeof formchangemanager !== 'undefined') {
formchangemanager.setFormStateById('{{$formname}}', FORM_CHANGED);
}
return row;
}
function makeCalendarInput(item, type, disabled) {
input = INPUT({
var label = LABEL({
'for': type + 'date_' + count,
'class': 'accessible-hidden'
}, get_string(type + 'date'));
var input = INPUT({
'type':'text',
'name': 'accesslist[' + count + '][' + type + 'date]',
'id' : type + 'date_' + count,
......@@ -233,7 +248,7 @@ function makeCalendarInput(item, type, disabled) {
input.disabled = (disabled == 0);
return input;
return SPAN(null, label, input);
}
function makeCalendarLink(item, type) {
......
......@@ -591,6 +591,7 @@ $smarty = smarty(
array(),
array(
'mahara' => array('From', 'To', 'datetimeformatguide'),
'view' => array('startdate', 'stopdate'),
'artefact.comment' => array('Comments', 'Allow', 'Moderate')
),
array('sidebars' => false)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment