Commit ab7f7b74 by E. Kolpakov

[TNL-6031] Added SR-only text notifying user that item is grabbed

parent 292c2baf
...@@ -53,6 +53,7 @@ function DragAndDropTemplates(configuration) { ...@@ -53,6 +53,7 @@ function DragAndDropTemplates(configuration) {
var itemTemplate = function(item, ctx) { var itemTemplate = function(item, ctx) {
// Define properties // Define properties
var descriptionClassName = "sr description";
var className = (item.class_name) ? item.class_name : ""; var className = (item.class_name) ? item.class_name : "";
var zone = getZone(item.zone, ctx) || {}; var zone = getZone(item.zone, ctx) || {};
if (item.has_image) { if (item.has_image) {
...@@ -118,18 +119,24 @@ function DragAndDropTemplates(configuration) { ...@@ -118,18 +119,24 @@ function DragAndDropTemplates(configuration) {
} }
var item_description = h( var item_description = h(
'div', 'div',
{ key: item.value + '-description', id: item_description_id, className: 'sr' }, { key: item.value + '-description', id: item_description_id, className: descriptionClassName },
description_content description_content
); );
} else { } else {
var item_description = h( var item_description = h(
'div', 'div',
{ id: item_description_id, className: 'sr'}, { id: item_description_id, className: descriptionClassName },
gettext('Press "Enter", "Space", "Ctrl-m", or "⌘-m" on an item to select it for dropping, then navigate to the zone you want to drop it on.') gettext('Press "Enter", "Space", "Ctrl-m", or "⌘-m" on an item to select it for dropping, then navigate to the zone you want to drop it on.')
); );
} }
children.splice(1, 0, item_description); children.splice(1, 0, item_description);
children.splice(1, 0, item_content); children.splice(1, 0, item_content);
if (item.grabbed) {
var itemGrabbedSRNote = h('span', { className: 'sr dragged' }, gettext("draggable, grabbed"));
children.splice(2, 0, itemGrabbedSRNote);
}
return ( return (
h( h(
'div.option', 'div.option',
......
...@@ -238,7 +238,9 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet ...@@ -238,7 +238,9 @@ class StandardInteractionTest(DefaultDataTestMixin, InteractionTestBase, Paramet
ActionChains(self.browser).move_to_element(item).perform() ActionChains(self.browser).move_to_element(item).perform()
keyboard_help_text = (u'Press "Enter", "Space", "Ctrl-m", or "⌘-m" on an item to select it for dropping, ' keyboard_help_text = (u'Press "Enter", "Space", "Ctrl-m", or "⌘-m" on an item to select it for dropping, '
'then navigate to the zone you want to drop it on.') 'then navigate to the zone you want to drop it on.')
self.assertEqual(item.find_element_by_css_selector('.sr').text, keyboard_help_text) self.assertEqual(item.find_element_by_css_selector('.sr.description').text, keyboard_help_text)
expected_sr_text = "draggable, grabbed"
self.assertEqual(item.find_element_by_css_selector('.sr.dragged').text, expected_sr_text)
def test_alt_text_for_zones(self): def test_alt_text_for_zones(self):
self._get_popup() self._get_popup()
......
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