Commit 42342fb5 authored by Jono Mingard's avatar Jono Mingard
Browse files

Use focus management in Resume composite forms (Bug #1262918)



Expandable fields (accessed by "Add" and "Edit" buttons) in Resume now
set focus to their first focusable child when opened and return focus
to the Add/Edit button when cancelled.

Change-Id: Ia1a4f5c5d3ce79ed416a7d146b91fef21f8c0744
Signed-off-by: default avatarJono Mingard <jonom@catalyst.net.nz>
parent b1b62431
......@@ -28,10 +28,12 @@ function connect_editbuttons() {
$j("#" + t + "edit_container").addClass("hidden");
$j("#" + t + "edit_container").removeClass("nojs-hidden-block");
if (typeof tinyMCE != 'undefined') {
tinyMCE.get(t).show();
var editor = tinyMCE.get(t);
editor.show()
editor.focus();
}
else {
$j("#" + t).removeClass("js-hidden");
$j("#" + t).removeClass("js-hidden").focus();
}
});
}
......@@ -52,6 +54,7 @@ function connect_cancelbuttons() {
else {
$j("#" + t).addClass("js-hidden");
}
$j("#" + t + "edit_container").find('input.openedit').focus();
});
}
......
......@@ -910,15 +910,15 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
var tableRenderers = {};
function toggleCompositeForm(type) {
var elemName = '';
elemName = type + 'form';
if (hasElementClass(elemName, 'hidden')) {
removeElementClass(elemName, 'hidden');
$('add' + type + 'button').innerHTML = {$cancelstr};
var elem = \$j('#' + type + 'form');
if (elem.hasClass('hidden')) {
elem.removeClass('hidden');
elem.find(':input').first().focus();
\$j('#add' + type + 'button').html({$cancelstr});
}
else {
$('add' + type + 'button').innerHTML = {$addstr};
addElementClass(elemName, 'hidden');
\$j('#add' + type + 'button').html({$addstr});
elem.addClass('hidden');
}
}
......
Markdown is supported
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