Commit 3066fdbb by Jonathan Piacenti

Better accessibility for feedback popups and higher contrast for dropped items.

parent b7d1134a
...@@ -9,6 +9,34 @@ ...@@ -9,6 +9,34 @@
margin-right: 3px; margin-right: 3px;
} }
/* Button style tricks, defined higher so they can be overridden */
.xblock--drag-and-drop .unbutton {
background: none;
box-shadow: none;
border: none;
padding: 0;
margin: 0;
}
.xblock--drag-and-drop .unbutton:active {
background: none;
box-shadow: none;
border: none;
}
.xblock--drag-and-drop .unbutton:hover {
background: none;
box-shadow: none;
border: none;
}
.xblock--drag-and-drop .unbutton:focus {
background: none;
box-shadow: none;
border: none;
}
/* Header, instruction text, etc. */ /* Header, instruction text, etc. */
.xblock--drag-and-drop .problem-title { .xblock--drag-and-drop .problem-title {
...@@ -180,7 +208,7 @@ ...@@ -180,7 +208,7 @@
} }
.xblock--drag-and-drop .drag-container .option.fade { .xblock--drag-and-drop .drag-container .option.fade {
opacity: 0.5; opacity: 0.80;
} }
/*** DROP TARGET ***/ /*** DROP TARGET ***/
...@@ -299,6 +327,10 @@ ...@@ -299,6 +327,10 @@
font-size: 18pt; font-size: 18pt;
} }
.xblock--drag-and-drop .popup .close:focus {
outline: 2px solid white;
}
/*** KEYBOARD HELP ***/ /*** KEYBOARD HELP ***/
.xblock--drag-and-drop .keyboard-help { .xblock--drag-and-drop .keyboard-help {
...@@ -373,21 +405,7 @@ ...@@ -373,21 +405,7 @@
} }
.xblock--drag-and-drop .link-button:focus { .xblock--drag-and-drop .link-button:focus {
background: none; outline: 2px solid #2d74b3;
box-shadow: none;
border: none;
}
.xblock--drag-and-drop .link-button:active {
background: none;
box-shadow: none;
border: none;
}
.xblock--drag-and-drop .link-button:hover {
background: none;
box-shadow: none;
border: none;
} }
/* Make sure screen-reader content is hidden in the workbench: */ /* Make sure screen-reader content is hidden in the workbench: */
......
...@@ -237,6 +237,7 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -237,6 +237,7 @@ function DragAndDropBlock(runtime, element, configuration) {
updateDOM(); updateDOM();
destroyDraggable(); destroyDraggable();
$element.find('div.popup').focus()
if (!state.finished) { if (!state.finished) {
initDraggable(); initDraggable();
} }
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
return ( return (
h('section.feedback', properties, [ h('section.feedback', properties, [
h( h(
'button.reset-button.link-button', 'button.reset-button.unbutton.link-button',
{ style: { display: reset_button_display }, attributes: { tabindex: 0 }, 'aria-live': 'off'}, { style: { display: reset_button_display }, attributes: { tabindex: 0 }, 'aria-live': 'off'},
gettext('Reset problem') gettext('Reset problem')
), ),
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
var dialog_style = {}; var dialog_style = {};
return ( return (
h('section.keyboard-help', [ h('section.keyboard-help', [
h('button.keyboard-help-button.link-button', { attributes: { tabindex: 0 } }, gettext('Keyboard Help')), h('button.keyboard-help-button.unbutton.link-button', { attributes: { tabindex: 0 } }, gettext('Keyboard Help')),
h('div.keyboard-help-dialog', [ h('div.keyboard-help-dialog', [
h('div.modal-window-overlay'), h('div.modal-window-overlay'),
h('div.modal-window', { attributes: dialog_attributes, style: dialog_style }, [ h('div.modal-window', { attributes: dialog_attributes, style: dialog_style }, [
...@@ -231,21 +231,22 @@ ...@@ -231,21 +231,22 @@
problemHeader, problemHeader,
h('p', {innerHTML: ctx.problem_html}), h('p', {innerHTML: ctx.problem_html}),
]), ]),
h('section.drag-container', [ h('section.drag-container', { attributes: { role: 'application' } }, [
h( h(
'div.item-bank', 'div.item-bank',
{ attributes: { role: 'application' } },
renderCollection(itemTemplate, items_in_bank, ctx) renderCollection(itemTemplate, items_in_bank, ctx)
), ),
h('div.target', [ h('div.target', [
h( h(
popupSelector, popupSelector,
{ {
attributes: {'aria-live': 'polite'}, attributes: {'aria-live': 'polite', 'tabindex': 0},
style: {display: ctx.popup_html ? 'block' : 'none'}, style: {display: ctx.popup_html ? 'block' : 'none'},
}, },
[ [
h('div.close.icon-remove-sign.fa-times-circle'), h('button.unbutton.close.icon-remove-sign.fa-times-circle', [
h('div', {attributes: {'class': 'sr'}}, gettext("Close"))
]),
h('p.popup-content', {innerHTML: ctx.popup_html}), h('p.popup-content', {innerHTML: ctx.popup_html}),
] ]
), ),
......
...@@ -165,9 +165,9 @@ class TestDragAndDropRender(BaseIntegrationTest): ...@@ -165,9 +165,9 @@ class TestDragAndDropRender(BaseIntegrationTest):
'This describes the background image of item {}'.format(item_number) 'This describes the background image of item {}'.format(item_number)
) )
def test_item_bank(self): def test_drag_container(self):
self.load_scenario() self.load_scenario()
item_bank = self._page.find_element_by_css_selector('.item-bank') item_bank = self._page.find_element_by_css_selector('.drag-container')
self.assertEqual(item_bank.get_attribute('role'), 'application') self.assertEqual(item_bank.get_attribute('role'), 'application')
def test_zones(self): def test_zones(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