MDL-68312 grade: Fix empty links
If a link contains no text, the function or purpose of the link will not be presented to the user. This can introduce confusion for keyboard and screen reader users.
This commit is contained in:
@@ -751,13 +751,18 @@ class grade_report_grader extends grade_report {
|
||||
$a = new stdClass();
|
||||
$a->user = $fullname;
|
||||
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
|
||||
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id));
|
||||
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser));
|
||||
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php',
|
||||
['userid' => $user->id, 'id' => $this->course->id]);
|
||||
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', ''), null,
|
||||
['title' => $strgradesforuser, 'aria-label' => $strgradesforuser]);
|
||||
}
|
||||
|
||||
if ($canseesingleview) {
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array('id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user'));
|
||||
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $fullname)));
|
||||
$strsingleview = get_string('singleview', 'grades', $fullname);
|
||||
$url = new moodle_url('/grade/report/singleview/index.php',
|
||||
['id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user']);
|
||||
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', ''), null,
|
||||
['title' => $strsingleview, 'aria-label' => $strsingleview]);
|
||||
$userreportcell->text .= $singleview;
|
||||
}
|
||||
|
||||
@@ -911,13 +916,16 @@ class grade_report_grader extends grade_report {
|
||||
if (has_all_capabilities(array('gradereport/singleview:view', 'moodle/grade:viewall',
|
||||
'moodle/grade:edit'), $this->context)) {
|
||||
|
||||
$strsingleview = get_string('singleview', 'grades', $element['object']->get_name());
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array(
|
||||
'id' => $this->course->id,
|
||||
'item' => 'grade',
|
||||
'itemid' => $element['object']->id));
|
||||
$singleview = $OUTPUT->action_icon(
|
||||
$url,
|
||||
new pix_icon('t/editstring', get_string('singleview', 'grades', $element['object']->get_name()))
|
||||
$url,
|
||||
new pix_icon('t/editstring', ''),
|
||||
null,
|
||||
['title' => $strsingleview, 'aria-label' => $strsingleview]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1636,15 +1644,18 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
|
||||
$url->param('action', 'switch_plus');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', $strswitchplus), null, null);
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', ''), null,
|
||||
['title' => $strswitchplus, 'aria-label' => $strswitchplus]);
|
||||
$showing = get_string('showingaggregatesonly', 'grades');
|
||||
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
|
||||
$url->param('action', 'switch_whole');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', $strswitchwhole), null, null);
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', ''), null,
|
||||
['title' => $strswitchwhole, 'aria-label' => $strswitchwhole]);
|
||||
$showing = get_string('showinggradesonly', 'grades');
|
||||
} else {
|
||||
$url->param('action', 'switch_minus');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', $strswitchminus), null, null);
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', ''), null,
|
||||
['title' => $strswitchminus, 'aria-label' => $strswitchminus]);
|
||||
$showing = get_string('showingfullmode', 'grades');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,8 +417,8 @@ abstract class grade_report {
|
||||
$matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'desc');
|
||||
$strsort = $this->get_lang_string('sort' . $matrix[$direction]);
|
||||
|
||||
$arrow = $OUTPUT->pix_icon($pix[$direction], $strsort, '', array('class' => 'sorticon'));
|
||||
return html_writer::link($sortlink, $arrow, array('title'=>$strsort));
|
||||
$arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']);
|
||||
return html_writer::link($sortlink, $arrow, ['title' => $strsort, 'aria-label' => $strsort]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user