mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-76603 gradingform_rubric: fix roles
- set the role of table to none - moved aria-label from <table> element (that doesn't has role="none") to the element that has the radiogroup role - if it's not radiogroup/radio, it is list/listitem - removed aria-label from the rubric table and used caption instead
This commit is contained in:
parent
556208417d
commit
8b0fe1ee00
@ -119,7 +119,10 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
|
||||
$criteriontemplate .= html_writer::tag('td', $description, $descriptiontdparams);
|
||||
|
||||
// Levels table.
|
||||
$levelsrowparams = array('id' => '{NAME}-criteria-{CRITERION-id}-levels');
|
||||
$levelsrowparams = [
|
||||
'id' => '{NAME}-criteria-{CRITERION-id}-levels',
|
||||
'aria-label' => get_string('levelsgroup', 'gradingform_rubric'),
|
||||
];
|
||||
// Add radiogroup role only when not previewing or editing.
|
||||
$isradiogroup = !in_array($mode, [
|
||||
gradingform_rubric_controller::DISPLAY_EDIT_FULL,
|
||||
@ -127,15 +130,13 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
|
||||
gradingform_rubric_controller::DISPLAY_PREVIEW,
|
||||
gradingform_rubric_controller::DISPLAY_PREVIEW_GRADED,
|
||||
]);
|
||||
if ($isradiogroup) {
|
||||
$levelsrowparams['role'] = 'radiogroup';
|
||||
}
|
||||
$levelsrowparams['role'] = $isradiogroup ? 'radiogroup' : 'list';
|
||||
$levelsrow = html_writer::tag('tr', $levelsstr, $levelsrowparams);
|
||||
|
||||
$levelstableparams = array(
|
||||
$levelstableparams = [
|
||||
'id' => '{NAME}-criteria-{CRITERION-id}-levels-table',
|
||||
'aria-label' => get_string('levelsgroup', 'gradingform_rubric')
|
||||
);
|
||||
'role' => 'none',
|
||||
];
|
||||
$levelsstrtable = html_writer::tag('table', $levelsrow, $levelstableparams);
|
||||
$levelsclass = 'levels';
|
||||
if (isset($criterion['error_levels'])) {
|
||||
@ -311,7 +312,11 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$tdattributes['aria-checked'] = 'false';
|
||||
}
|
||||
} else {
|
||||
$tdattributes['role'] = 'listitem';
|
||||
}
|
||||
} else {
|
||||
$tdattributes['role'] = 'listitem';
|
||||
}
|
||||
|
||||
$leveltemplateparams = array(
|
||||
@ -395,11 +400,12 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
|
||||
$rubrictemplate = html_writer::start_tag('div', array('id' => 'rubric-{NAME}', 'class' => 'clearfix gradingform_rubric'.$classsuffix));
|
||||
|
||||
// Rubric table.
|
||||
$rubrictableparams = array(
|
||||
$rubrictableparams = [
|
||||
'class' => 'criteria',
|
||||
'id' => '{NAME}-criteria',
|
||||
'aria-label' => get_string('rubric', 'gradingform_rubric'));
|
||||
$rubrictable = html_writer::tag('table', $criteriastr, $rubrictableparams);
|
||||
];
|
||||
$caption = html_writer::tag('caption', get_string('rubric', 'gradingform_rubric'), ['class' => 'sr-only']);
|
||||
$rubrictable = html_writer::tag('table', $caption . $criteriastr, $rubrictableparams);
|
||||
$rubrictemplate .= $rubrictable;
|
||||
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FULL) {
|
||||
$value = get_string('addcriterion', 'gradingform_rubric');
|
||||
|
Loading…
x
Reference in New Issue
Block a user