Skip to content

Commit

Permalink
MDL-64493 completion: Manual completion Ally
Browse files Browse the repository at this point in the history
Do not use duplicate title attributes on buttons, use aria-live to force the correct state to be
read after clicking on a button.
  • Loading branch information
Damyon Wiese committed Jan 24, 2019
1 parent c092f75 commit 7219f59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions course/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
});
}
Expand Down
2 changes: 1 addition & 1 deletion course/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public function course_section_cm_completion($course, &$completioninfo, cm_info
'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 {
Expand Down

0 comments on commit 7219f59

Please sign in to comment.