Skip to content

Commit

Permalink
MDL-35980 comment: add comment info to delete button for screen readers
Browse files Browse the repository at this point in the history
For each delete button in the comments widget, make the spoken text a
string containing the name of the poster and the datetime.
  • Loading branch information
snake committed Feb 24, 2017
1 parent 0f59b6d commit 86f1d1b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion admin/tool/lp/templates/comment_area.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ require(['core/str'], function(Str) {
{ key: 'comments', component: 'moodle' },
{ key: 'commentscount', component: 'moodle' },
{ key: 'commentsrequirelogin', component: 'moodle' },
{ key: 'deletecomment', component: 'moodle' },
{ key: 'deletecommentbyon', component: 'moodle' },
]).then(function() {
// Kick off when strings are loaded.
Y.use('core_comment', function(Y) {
Expand Down
12 changes: 11 additions & 1 deletion comment/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,17 @@ M.core_comment = {
val = val.replace('___name___', list[i].fullname);
}
if (list[i]['delete']||newcmt) {
list[i].content = '<div class="comment-delete"><a href="#" id ="comment-delete-'+this.client_id+'-'+list[i].id+'" title="'+M.util.get_string('deletecomment', 'moodle')+'"><img alt="" src="'+M.util.image_url('t/delete', 'core')+'" /></a></div>' + list[i].content;
var tokens = {
user: list[i].fullname,
time: list[i].time
};
var deleteStr = Y.Escape.html(M.util.get_string('deletecommentbyon', 'moodle', tokens));
list[i].content = '<div class="comment-delete">' +
'<a href="#" role="button" id ="comment-delete-' + this.client_id + '-' + list[i].id + '"' +
' title="' + deleteStr + '">' +
'<img alt="' + deleteStr + '" src="' + M.util.image_url('t/delete', 'core') + '" />' +
'</a>' +
'</div>' + list[i].content;
}
val = val.replace('___time___', list[i].time);
val = val.replace('___picture___', list[i].avatar);
Expand Down
2 changes: 1 addition & 1 deletion comment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public static function init(moodle_page $page = null) {
'comments',
'commentscount',
'commentsrequirelogin',
'deletecomment',
'deletecommentbyon',
),
'moodle'
);
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@
$string['deletecategorycheck'] = 'Are you absolutely sure you want to completely delete this category <b>\'{$a}\'</b>?<br />This will move all courses into the parent category if there is one, or into Miscellaneous.';
$string['deletecategorycheck2'] = 'If you delete this category, you need to choose what to do with the courses and subcategories it contains.';
$string['deletecomment'] = 'Delete this comment';
$string['deletecommentbyon'] = 'Delete comment posted by {$a->user} on {$a->time}';
$string['deletecompletely'] = 'Delete completely';
$string['deletecourse'] = 'Delete a course';
$string['deletecoursecheck'] = 'Are you absolutely sure you want to completely delete this course and all the data it contains?';
Expand Down
2 changes: 1 addition & 1 deletion lib/outputrequirementslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ protected function find_module($component) {
case 'core_comment':
$module = array('name' => 'core_comment',
'fullpath' => '/comment/comment.js',
'requires' => array('base', 'io-base', 'node', 'json', 'yui2-animation', 'overlay'),
'requires' => array('base', 'io-base', 'node', 'json', 'yui2-animation', 'overlay', 'escape'),
'strings' => array(array('confirmdeletecomments', 'admin'), array('yes', 'moodle'), array('no', 'moodle'))
);
break;
Expand Down

0 comments on commit 86f1d1b

Please sign in to comment.