Commit 7f37b097 by Matjaz Gregoric

Reference problem title when present.

The role="group" wrapper of the problem should use aria-labelledby
referencing the problem title.

If the problem is configured to not show the title, the hardcoded
"Drag and Drop Problem" aria-label is used.
parent 0d1b20e0
...@@ -501,13 +501,19 @@ function DragAndDropTemplates(configuration) { ...@@ -501,13 +501,19 @@ function DragAndDropTemplates(configuration) {
}; };
var mainTemplate = function(ctx) { var mainTemplate = function(ctx) {
var main_element_properties = {attributes: {role: 'group'}};
var problemProgress = progressTemplate(ctx); var problemProgress = progressTemplate(ctx);
var problemTitle = null; var problemTitle = null;
if (ctx.show_title) { if (ctx.show_title) {
var problem_title_id = configuration.url_name + '-problem-title';
problemTitle = h('h3.problem-title', { problemTitle = h('h3.problem-title', {
id: problem_title_id,
innerHTML: ctx.title_html, innerHTML: ctx.title_html,
attributes: {'aria-describedby': problemProgress.properties.id} attributes: {'aria-describedby': problemProgress.properties.id}
}); });
main_element_properties.attributes['arial-labelledby'] = problem_title_id;
} else {
main_element_properties.attributes['aria-label'] = gettext('Drag and Drop Problem');
} }
var problemHeader = ctx.show_problem_header ? h('h4.title1', gettext('Problem')) : null; var problemHeader = ctx.show_problem_header ? h('h4.title1', gettext('Problem')) : null;
// Render only items in the bank here, including placeholders. Placed // Render only items in the bank here, including placeholders. Placed
...@@ -526,12 +532,6 @@ function DragAndDropTemplates(configuration) { ...@@ -526,12 +532,6 @@ function DragAndDropTemplates(configuration) {
item_bank_properties.attributes['dropzone'] = 'move'; item_bank_properties.attributes['dropzone'] = 'move';
item_bank_properties.attributes['aria-dropeffect'] = 'move'; item_bank_properties.attributes['aria-dropeffect'] = 'move';
} }
var main_element_properties = {
attributes: {
'role': 'group',
'aria-label': gettext('Drag and Drop Problem')
}
};
return ( return (
h('div.themed-xblock.xblock--drag-and-drop', main_element_properties, [ h('div.themed-xblock.xblock--drag-and-drop', main_element_properties, [
problemTitle, problemTitle,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment