Commit 994cb556 by Tim Krones

Keyboard accessibility for resetting exercise.

parent 6ab95917
...@@ -61,6 +61,11 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -61,6 +61,11 @@ function DragAndDropBlock(runtime, element, configuration) {
} }
}); });
$element.on('click', '.reset-button', resetExercise); $element.on('click', '.reset-button', resetExercise);
$element.on('keydown', '.reset-button', function(evt) {
if (evt.which === RET) {
resetExercise(evt);
}
});
$element.on('click', '.submit-input', submitInput); $element.on('click', '.submit-input', submitInput);
// Indicate that exercise is done loading // Indicate that exercise is done loading
...@@ -483,7 +488,8 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -483,7 +488,8 @@ function DragAndDropBlock(runtime, element, configuration) {
applyState(); applyState();
}; };
var resetExercise = function() { var resetExercise = function(evt) {
evt.preventDefault();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: runtime.handlerUrl(element, 'reset'), url: runtime.handlerUrl(element, 'reset'),
......
...@@ -147,10 +147,13 @@ ...@@ -147,10 +147,13 @@
var properties = { attributes: { 'aria-live': 'polite' } }; var properties = { attributes: { 'aria-live': 'polite' } };
return ( return (
h('section.feedback', properties, [ h('section.feedback', properties, [
h('div.reset-button', {style: {display: reset_button_display}}, gettext('Reset exercise')), h(
h('h3.title1', {style: {display: feedback_display}}, gettext('Feedback')), 'a.reset-button',
h('p.message', {style: {display: feedback_display}, { style: { display: reset_button_display }, attributes: { tabindex: 0 }},
innerHTML: ctx.feedback_html}) gettext('Reset exercise')
),
h('h3.title1', { style: { display: feedback_display } }, gettext('Feedback')),
h('p.message', { style: { display: feedback_display }, innerHTML: ctx.feedback_html })
]) ])
); );
}; };
......
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