MDL-54833 workshop: Provide accessible links to the current phase tasks
The screen reader had to read through all the phases tasks. This patch adds an accessibility link to the list of the current phase tasks so the user can skip directly to them.
This commit is contained in:
@@ -329,6 +329,7 @@ $string['userdatemodified'] = 'modified on <span>{$a}</span>';
|
||||
$string['userplan'] = 'Workshop planner';
|
||||
$string['userplancurrentphase'] = 'Current phase';
|
||||
$string['userplan_help'] = 'The workshop planner displays all phases of the activity and lists the tasks for each phase. The current phase is highlighted and task completion is indicated with a tick.';
|
||||
$string['userplanaccessibilityskip'] = 'Skip to current tasks';
|
||||
$string['userplanaccessibilitytitle'] = 'Workshop timeline with {$a} phases';
|
||||
$string['useselfassessment'] = 'Use self-assessment';
|
||||
$string['useselfassessment_help'] = 'If enabled, a user may be allocated their own submission to assess and will receive a grade for assessment in addition to a grade for their submission.';
|
||||
|
||||
@@ -283,8 +283,14 @@ class mod_workshop_renderer extends plugin_renderer_base {
|
||||
protected function render_workshop_user_plan(workshop_user_plan $plan) {
|
||||
$o = ''; // Output HTML code.
|
||||
$numberofphases = count($plan->phases);
|
||||
$o .= html_writer::start_tag('div', array('class' => 'userplan'));
|
||||
$o .= html_writer::tag('span', get_string('userplanaccessibilitytitle', 'workshop', $numberofphases),
|
||||
$o .= html_writer::start_tag('div', array(
|
||||
'class' => 'userplan',
|
||||
'aria-labelledby' => 'mod_workshop-userplanheading',
|
||||
'aria-describedby' => 'mod_workshop-userplanaccessibilitytitle',
|
||||
));
|
||||
$o .= html_writer::span(get_string('userplanaccessibilitytitle', 'workshop', $numberofphases),
|
||||
'accesshide', array('id' => 'mod_workshop-userplanaccessibilitytitle'));
|
||||
$o .= html_writer::link('#mod_workshop-userplancurrenttasks', get_string('userplanaccessibilityskip', 'workshop'),
|
||||
array('class' => 'accesshide'));
|
||||
foreach ($plan->phases as $phasecode => $phase) {
|
||||
$o .= html_writer::start_tag('dl', array('class' => 'phase'));
|
||||
@@ -306,10 +312,9 @@ class mod_workshop_renderer extends plugin_renderer_base {
|
||||
if (!empty($actions)) {
|
||||
$actions = $this->output->container($actions, 'actions');
|
||||
}
|
||||
$title = html_writer::tag('span', $phase->title);
|
||||
$title = html_writer::span($phase->title, '', array('id' => 'mod_workshop-userplancurrenttasks'));
|
||||
if ($phase->active) {
|
||||
$title .= ' ' . html_writer::tag('span', get_string('userplancurrentphase', 'workshop'),
|
||||
array('class' => 'accesshide'));
|
||||
$title .= ' ' . html_writer::span(get_string('userplancurrentphase', 'workshop'), 'accesshide');
|
||||
}
|
||||
$classes = 'phase' . $phasecode;
|
||||
if ($phase->active) {
|
||||
|
||||
@@ -114,7 +114,7 @@ $output = $PAGE->get_renderer('mod_workshop');
|
||||
|
||||
echo $output->header();
|
||||
echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
|
||||
echo $output->heading(format_string($currentphasetitle), 3);
|
||||
echo $output->heading(format_string($currentphasetitle), 3, null, 'mod_workshop-userplanheading');
|
||||
echo $output->render($userplan);
|
||||
|
||||
switch ($workshop->phase) {
|
||||
|
||||
Reference in New Issue
Block a user