diff --git a/grade/lib.php b/grade/lib.php index 67857cb02fa..2e8c8d33d1b 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -1791,8 +1791,9 @@ class grade_structure { return ''; } - return $OUTPUT->action_icon($url, new pix_icon('t/preview', - get_string('gradeanalysis', 'core_grades'))); + $title = get_string('gradeanalysis', 'core_grades'); + return $OUTPUT->action_icon($url, new pix_icon('t/preview', ''), null, + ['title' => $title, 'aria-label' => $title]); } /** diff --git a/grade/report/singleview/classes/local/screen/grade.php b/grade/report/singleview/classes/local/screen/grade.php index ddebda79b55..f3b4ad7e72c 100644 --- a/grade/report/singleview/classes/local/screen/grade.php +++ b/grade/report/singleview/classes/local/screen/grade.php @@ -208,11 +208,12 @@ class grade extends tablelike implements selectable_items, filterable_items { $url = new moodle_url("/user/view.php", array('id' => $item->id, 'course' => $this->courseid)); $iconstring = get_string('filtergrades', 'gradereport_singleview', $fullname); $grade->label = $fullname; + $userpic = $OUTPUT->user_picture($item, ['link' => false, 'visibletoscreenreaders' => false]); $line = array( - $OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', $iconstring)), - $OUTPUT->user_picture($item, array('visibletoscreenreaders' => false)) . - html_writer::link($url, $fullname), + $OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', ''), null, + ['title' => $iconstring, 'aria-label' => $iconstring]), + html_writer::link($url, $userpic . $fullname), $this->item_range() ); $lineclasses = array( diff --git a/grade/report/singleview/classes/local/screen/tablelike.php b/grade/report/singleview/classes/local/screen/tablelike.php index 9c5f025315b..3498fe4a804 100644 --- a/grade/report/singleview/classes/local/screen/tablelike.php +++ b/grade/report/singleview/classes/local/screen/tablelike.php @@ -172,7 +172,8 @@ abstract class tablelike extends screen { $summary = $this->summary(); if (!empty($summary)) { - $table->summary = $summary; + $table->caption = $summary; + $table->captionhide = true; } // To be used for extra formatting. diff --git a/grade/report/singleview/classes/local/screen/user.php b/grade/report/singleview/classes/local/screen/user.php index 3043a8694a9..3e90a88b771 100644 --- a/grade/report/singleview/classes/local/screen/user.php +++ b/grade/report/singleview/classes/local/screen/user.php @@ -190,7 +190,8 @@ class user extends tablelike implements selectable_items { $grade->label = $item->get_name(); $line = array( - $OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', $iconstring)), + $OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', ''), null, + ['title' => $iconstring, 'aria-label' => $iconstring]), $this->format_icon($item) . $lockicon . $itemlabel, $this->category($item), new range($item) diff --git a/grade/report/singleview/templates/text_attribute.mustache b/grade/report/singleview/templates/text_attribute.mustache index 6c73b9cf6b9..47a1ae34b10 100644 --- a/grade/report/singleview/templates/text_attribute.mustache +++ b/grade/report/singleview/templates/text_attribute.mustache @@ -28,6 +28,6 @@ "disabled": "true" } }} - +{{#label}}{{/label}} diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index d739164ac20..7374b5b14e6 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -2207,8 +2207,9 @@ class html_writer { $heading->header = true; } - if ($heading->header && empty($heading->scope)) { - $heading->scope = 'col'; + $tagtype = 'td'; + if ($heading->header && (string)$heading->text != '') { + $tagtype = 'th'; } $heading->attributes['class'] .= ' header c' . $key; @@ -2224,16 +2225,15 @@ class html_writer { $heading->attributes['class'] .= ' ' . $table->colclasses[$key]; } $heading->attributes['class'] = trim($heading->attributes['class']); - $attributes = array_merge($heading->attributes, array( - 'style' => $table->align[$key] . $table->size[$key] . $heading->style, - 'scope' => $heading->scope, - 'colspan' => $heading->colspan, - )); + $attributes = array_merge($heading->attributes, [ + 'style' => $table->align[$key] . $table->size[$key] . $heading->style, + 'colspan' => $heading->colspan, + ]); - $tagtype = 'td'; - if ($heading->header === true) { - $tagtype = 'th'; + if ($tagtype == 'th') { + $attributes['scope'] = !empty($heading->scope) ? $heading->scope : 'col'; } + $output .= html_writer::tag($tagtype, $heading->text, $attributes) . "\n"; } $output .= html_writer::end_tag('tr') . "\n";