Commit 0d1b20e0 by Matjaz Gregoric

Remove aria-live attribute from feedback regions.

We are now using SR.readText function to prompt the screen reader to
read feedback messages, so there is no need to use aria-live, which was
sometimes conflicting with SR.readText.
parent ea3b1534
......@@ -249,7 +249,7 @@ function DragAndDropTemplates(configuration) {
h('div.feedback', {attributes: {'role': 'group', 'aria-label': gettext('Feedback')}}, [
h(
"div.feedback-content",
{attributes: {'aria-live': 'polite', 'aria-atomic': 'true', 'aria-relevant': 'all'}},
{},
[
h('h3.title1', { style: { display: feedback_display } }, gettext('Feedback')),
h('div.messages', { style: { display: feedback_display } }, feedback_messages),
......@@ -408,12 +408,7 @@ function DragAndDropTemplates(configuration) {
popupSelector,
{
style: {display: have_messages ? 'block' : 'none'},
attributes: {
"tabindex": "-1",
'aria-live': 'polite',
'aria-atomic': 'true',
'aria-relevant': 'all',
}
attributes: {"tabindex": "-1"}
},
[
h(
......@@ -501,7 +496,7 @@ function DragAndDropTemplates(configuration) {
return h('div.problem-progress', {
id: configuration.url_name + '-problem-progress',
attributes: {'role': 'status', 'aria-live': 'polite'}
attributes: {role: 'status'}
}, progress_text);
};
......@@ -883,7 +878,6 @@ function DragAndDropBlock(runtime, element, configuration) {
var applyState = function(keepDraggableInit) {
sendFeedbackPopupEvents();
updateDOM();
readScreenReaderMessages();
if (!keepDraggableInit) {
destroyDraggable();
if (!state.finished) {
......@@ -930,7 +924,7 @@ function DragAndDropBlock(runtime, element, configuration) {
// Uses edX JS accessibility tools to read feedback messages when present.
var readScreenReaderMessages = function() {
if (window.SR && window.SR.readText && window.SR.clear) {
if (window.SR && window.SR.readText) {
var pluckMessages = function(feedback_items) {
return feedback_items.map(function(item) {
return item.message;
......@@ -948,7 +942,7 @@ function DragAndDropBlock(runtime, element, configuration) {
if (state.feedback && configuration.mode === DragAndDropBlock.ASSESSMENT_MODE) {
if (state.feedback.length > 0) {
if (!state.last_action_correct) {
messages.push(gettext("Some of your answers were not correct."))
messages.push(gettext("Some of your answers were not correct."));
}
messages = messages.concat(
gettext("Hints:"),
......@@ -956,8 +950,6 @@ function DragAndDropBlock(runtime, element, configuration) {
);
}
}
SR.clear();
SR.readText(messages.join('\n'));
}
};
......@@ -1266,6 +1258,7 @@ function DragAndDropBlock(runtime, element, configuration) {
state.finished = true;
state.overall_feedback = data.overall_feedback;
}
readScreenReaderMessages();
}
applyState();
if (state.feedback && state.feedback.length > 0) {
......@@ -1370,6 +1363,7 @@ function DragAndDropBlock(runtime, element, configuration) {
} else {
state.finished = true;
}
readScreenReaderMessages();
}).always(function() {
state.submit_spinner = false;
applyState();
......
......@@ -173,7 +173,6 @@ class BaseIntegrationTest(SeleniumBaseTest):
"""
window.SR = {
received_texts: [],
clear: function() {},
readText: function(text) {
window.SR.received_texts.push(text);
}
......
......@@ -203,12 +203,10 @@ class TestDragAndDropRender(BaseIntegrationTest):
self.load_scenario()
popup = self._get_popup()
popup_wrapper = self._get_popup_wrapper()
popup_content = self._get_popup_content()
self.assertFalse(popup.is_displayed())
self.assertIn('popup', popup.get_attribute('class'))
self.assertEqual(popup_content.text, "")
self.assertEqual(popup_wrapper.get_attribute('aria-live'), 'polite')
@data(None, Keys.RETURN)
def test_go_to_beginning_button(self, action_key):
......@@ -252,9 +250,7 @@ class TestDragAndDropRender(BaseIntegrationTest):
def test_feedback(self):
self.load_scenario()
feedback = self._get_feedback()
feedback_message = self._get_feedback_message()
self.assertEqual(feedback.get_attribute('aria-live'), 'polite')
self.assertEqual(feedback_message.text, START_FEEDBACK)
def test_background_image(self):
......
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