Fixed accessibility labels are not always created in problems.
STUD-1524
This commit is contained in:
@@ -538,7 +538,7 @@ describe 'MarkdownEditingDescriptor', ->
|
||||
|
||||
<p>What is the capital of Germany?</p>
|
||||
<multiplechoiceresponse>
|
||||
<choicegroup type="MultipleChoice">
|
||||
<choicegroup label="What is the capital of Germany?" type="MultipleChoice">
|
||||
<choice correct="false">Bonn</choice>
|
||||
<choice correct="false">Hamburg</choice>
|
||||
<choice correct="true">Berlin</choice>
|
||||
|
||||
@@ -359,7 +359,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
// looks for >>arbitrary text<< and inserts it into the label attribute of the input type directly below the text.
|
||||
var split = xml.split('\n');
|
||||
var new_xml = [];
|
||||
var line, i, curlabel = '';
|
||||
var line, i, curlabel, prevlabel = '';
|
||||
var didinput = false;
|
||||
for (i = 0; i < split.length; i++) {
|
||||
line = split[i];
|
||||
@@ -370,13 +370,14 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
line = line.replace(/>>|<</g, '');
|
||||
} else if (line.match(/<\w+response/) && didinput) {
|
||||
} else if (line.match(/<\w+response/) && didinput && curlabel == prevlabel) {
|
||||
// reset label to prevent gobbling up previous one (if multiple questions)
|
||||
curlabel = '';
|
||||
didinput = false;
|
||||
} else if (line.match(/<(textline|optioninput|formulaequationinput|choicegroup|checkboxgroup)/) && curlabel != '') {
|
||||
} else if (line.match(/<(textline|optioninput|formulaequationinput|choicegroup|checkboxgroup)/) && curlabel != '' && curlabel != undefined) {
|
||||
line = line.replace(/<(textline|optioninput|formulaequationinput|choicegroup|checkboxgroup)/, '<$1 label="' + curlabel + '"');
|
||||
didinput = true;
|
||||
prevlabel = curlabel;
|
||||
}
|
||||
new_xml.push(line);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user