mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-42783 Course: Improve accessiblity of various course actions
This commit is contained in:
parent
40dd8899ab
commit
4c0664b950
@ -2065,9 +2065,9 @@ function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null) {
|
||||
|
||||
$actions[$actionname] = new action_menu_link_primary(
|
||||
new moodle_url($baseurl, array('id' => $mod->id, 'groupmode' => $nextgroupmode)),
|
||||
new pix_icon($groupimage, $grouptitle, 'moodle', array('class' => 'iconsmall', 'title' => '')),
|
||||
new pix_icon($groupimage, null, 'moodle', array('class' => 'iconsmall')),
|
||||
$grouptitle,
|
||||
array('class' => 'editing_'. $actionname, 'data-action' => $actionname, 'data-nextgroupmode' => $nextgroupmode)
|
||||
array('class' => 'editing_'. $actionname, 'data-action' => $actionname, 'data-nextgroupmode' => $nextgroupmode, 'aria-live' => 'assertive')
|
||||
);
|
||||
} else {
|
||||
$actions['nogroupsupport'] = new action_menu_filler();
|
||||
|
44
course/yui/toolboxes/toolboxes.js
vendored
44
course/yui/toolboxes/toolboxes.js
vendored
@ -222,8 +222,9 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
*
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer : function() {
|
||||
M.course.coursebase.register_module(this);
|
||||
BODY.delegate('key', this.handle_data_action, 'down:enter', SELECTOR.ACTIVITYACTION, this);
|
||||
Y.delegate('click', this.handle_data_action, BODY, SELECTOR.ACTIVITYACTION, this);
|
||||
},
|
||||
|
||||
@ -253,6 +254,7 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
// It wasn't a valid action node.
|
||||
return;
|
||||
}
|
||||
Y.log(ev.type);
|
||||
|
||||
// Switch based upon the action and do the desired thing.
|
||||
switch (action) {
|
||||
@ -345,15 +347,19 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
var spinner = this.add_spinner(activity);
|
||||
this.send_request(data, spinner);
|
||||
|
||||
var remainingmove;
|
||||
|
||||
// Handle removal/addition of the moveleft button.
|
||||
if (newindent === INDENTLIMITS.MIN) {
|
||||
button.addClass('hidden');
|
||||
remainingmove = activity.one('.editing_moveright');
|
||||
} else if (newindent > INDENTLIMITS.MIN && oldindent === INDENTLIMITS.MIN) {
|
||||
button.ancestor('.menu').one('[data-action=moveleft]').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (newindent === INDENTLIMITS.MAX) {
|
||||
button.addClass('hidden');
|
||||
remainingmove = activity.one('.editing_moveleft');
|
||||
} else if (newindent < INDENTLIMITS.MAX && oldindent === INDENTLIMITS.MAX) {
|
||||
button.ancestor('.menu').one('[data-action=moveright]').removeClass('hidden');
|
||||
}
|
||||
@ -365,6 +371,10 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
} else if (newindent <= 15 && hashugeclass) {
|
||||
indentdiv.removeClass(CSS.MODINDENTHUGE);
|
||||
}
|
||||
|
||||
if (ev.type && ev.type === "key" && remainingmove) {
|
||||
remainingmove.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -509,14 +519,22 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
availabilityinfo = activity.one(CSS.AVAILABILITYINFODIV),
|
||||
nextaction = (action === 'hide') ? 'show' : 'hide',
|
||||
buttontext = button.one('span'),
|
||||
newstring = M.util.get_string(nextaction, 'moodle');
|
||||
newstring = M.util.get_string(nextaction, 'moodle'),
|
||||
buttonimg = button.one('img');
|
||||
|
||||
// Update button info.
|
||||
button.one('img').setAttrs({
|
||||
'alt' : newstring,
|
||||
buttonimg.setAttrs({
|
||||
'src' : M.util.image_url('t/' + nextaction)
|
||||
});
|
||||
button.set('title', newstring);
|
||||
|
||||
if (Y.Lang.trim(button.getAttribute('title'))) {
|
||||
button.setAttribute('title', newstring);
|
||||
}
|
||||
|
||||
if (Y.Lang.trim(buttonimg.getAttribute('alt'))) {
|
||||
buttonimg.setAttribute('alt', newstring);
|
||||
}
|
||||
|
||||
button.replaceClass('editing_'+action, 'editing_'+nextaction);
|
||||
button.setData('action', nextaction);
|
||||
if (buttontext) {
|
||||
@ -564,7 +582,8 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
newtitlestr,
|
||||
data,
|
||||
spinner,
|
||||
nextgroupmode = groupmode + 1;
|
||||
nextgroupmode = groupmode + 1,
|
||||
buttonimg = button.one('img');
|
||||
|
||||
if (nextgroupmode > 2) {
|
||||
nextgroupmode = 0;
|
||||
@ -584,11 +603,16 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
newtitlestr = M.util.get_string('clicktochangeinbrackets', 'moodle', newtitlestr);
|
||||
|
||||
// Change the UI
|
||||
button.one('img').setAttrs({
|
||||
'alt' : newtitlestr,
|
||||
buttonimg.setAttrs({
|
||||
'src' : iconsrc
|
||||
});
|
||||
button.setAttribute('title', newtitlestr).setData('action', newtitle).setData('nextgroupmode', nextgroupmode);
|
||||
if (Y.Lang.trim(button.getAttribute('title'))) {
|
||||
button.setAttribute('title', newtitlestr).setData('action', newtitle).setData('nextgroupmode', nextgroupmode);
|
||||
}
|
||||
|
||||
if (Y.Lang.trim(buttonimg.getAttribute('alt'))) {
|
||||
buttonimg.setAttribute('alt', newtitlestr);
|
||||
}
|
||||
|
||||
// And send the request
|
||||
data = {
|
||||
@ -974,6 +998,6 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||
|
||||
},
|
||||
'@VERSION@', {
|
||||
requires : ['base', 'node', 'io', 'moodle-course-coursebase', 'moodle-course-util']
|
||||
requires : ['base', 'event-key', 'node', 'io', 'moodle-course-coursebase', 'moodle-course-util']
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user