MDL-64493 completion: Manual completion Ally

Do not use duplicate title attributes on buttons, use aria-live to force the correct state to be
read after clicking on a button.
This commit is contained in:
Damyon Wiese 2019-01-04 10:55:36 +08:00
parent c092f75791
commit 7219f590f3
2 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,6 @@ M.core_completion.init = function(Y) {
iconkey,
button = args.image.get('parentNode');
if (current == 1) {
altstr = M.util.get_string('completion-alt-manual-y', 'completion', modulename);
iconkey = 'i/completion-manual-y';
@ -33,11 +32,13 @@ M.core_completion.init = function(Y) {
iconkey = 'i/completion-manual-n';
args.state.set('value', 1);
}
button.set('title', altstr);
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix(iconkey, 'core', altstr).then(function(html) {
Templates.replaceNode(args.image.getDOMNode(), html, '');
var id = button.get('id'),
postFocus = '$(document.getElementById("' + id + '")).focus();';
Templates.replaceNode(args.image.getDOMNode(), html, postFocus);
}).catch(Notification.exception);
});
}

View File

@ -503,7 +503,7 @@ class core_course_renderer extends plugin_renderer_base {
'type' => 'hidden', 'name' => 'completionstate', 'value' => $newstate));
$output .= html_writer::tag('button',
$this->output->pix_icon('i/completion-' . $completionicon, $imgalt),
array('class' => 'btn btn-link', 'title' => $imgalt));
array('class' => 'btn btn-link', 'aria-live' => 'assertive'));
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('form');
} else {