MDL-83654 qtype_match: Only add the question text to the first field
In order to avoid repetition of the question text as the user navigates to each answer field in a matching question (e.g. by tabbing).
This commit is contained in:
@@ -79,6 +79,14 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer {
|
||||
$feedbackimage = $this->feedback_image($fraction);
|
||||
}
|
||||
|
||||
// We only want to add the question text to the first answer field to
|
||||
// avoid repetition of the question text for the subsequent answer fields.
|
||||
if ($i == 1) {
|
||||
$ariadescribedbyids = $questiontextid . ' ' . $itemtextid;
|
||||
} else {
|
||||
$ariadescribedbyids = $itemtextid;
|
||||
}
|
||||
|
||||
$labeltext = $options->add_question_identifier_to_label(get_string('answer', 'qtype_match', $i));
|
||||
$result .= html_writer::tag('td',
|
||||
html_writer::label($labeltext,
|
||||
@@ -89,7 +97,7 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer {
|
||||
[
|
||||
'disabled' => $options->readonly,
|
||||
'class' => 'form-select d-inline-block ms-1',
|
||||
'aria-describedby' => "$questiontextid $itemtextid",
|
||||
'aria-describedby' => $ariadescribedbyids,
|
||||
]) .
|
||||
' ' . $feedbackimage, array('class' => $classes, 'role' => 'presentation'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user