Commit f4391b5e by Dave St.Germain

fixing drag and drop

parent 72d9a91f
<section id="inputtype_${id}" class="capa_inputtype" > <div id="inputtype_${id}" class="capa_inputtype" role="application">
<div class="drag_and_drop_problem_div" id="drag_and_drop_div_${id}" <div class="drag_and_drop_problem_div" id="drag_and_drop_div_${id}"
data-plain-id="${id}"> data-plain-id="${id}">
</div> </div>
...@@ -29,4 +29,4 @@ ...@@ -29,4 +29,4 @@
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div> </div>
% endif % endif
</section> </div>
...@@ -17,7 +17,7 @@ define([], function () { ...@@ -17,7 +17,7 @@ define([], function () {
'></div>' '></div>'
); );
state.baseImageEl = $('<img />'); state.baseImageEl = $('<img alt="drop target" />');
state.baseImageEl.attr('src', state.config.baseImage); state.baseImageEl.attr('src', state.config.baseImage);
state.baseImageEl.load(function () { state.baseImageEl.load(function () {
......
...@@ -28,6 +28,7 @@ return { ...@@ -28,6 +28,7 @@ return {
if (this.numDraggablesOnMe > 0) { if (this.numDraggablesOnMe > 0) {
return; return;
} }
this.containerEl.attr('aria-grabbed', 'true');
// If this draggable is just being dragged out of the // If this draggable is just being dragged out of the
// container, we must perform some additional tasks. // container, we must perform some additional tasks.
...@@ -63,6 +64,7 @@ return { ...@@ -63,6 +64,7 @@ return {
}); });
this.iconEl.appendTo(this.state.baseImageEl.parent()); this.iconEl.appendTo(this.state.baseImageEl.parent());
if (this.labelEl !== null) { if (this.labelEl !== null) {
if (this.isOriginal === true) { if (this.isOriginal === true) {
this.labelEl.detach(); this.labelEl.detach();
...@@ -98,6 +100,7 @@ return { ...@@ -98,6 +100,7 @@ return {
'mouseUp': function () { 'mouseUp': function () {
if (this.mousePressed === true) { if (this.mousePressed === true) {
this.state.currentMovingDraggable = null; this.state.currentMovingDraggable = null;
this.containerEl.attr('aria-grabbed', 'false');
this.checkLandingElement(); this.checkLandingElement();
} }
......
...@@ -64,7 +64,7 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab ...@@ -64,7 +64,7 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab
'color: black; ' + 'color: black; ' +
'font-size: 0.95em; ' + 'font-size: 0.95em; ' +
'" ' + '" ' +
'>' + 'role="label">' +
draggableObj.originalConfigObj.label + draggableObj.originalConfigObj.label +
'</div>' '</div>'
); );
...@@ -153,6 +153,8 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab ...@@ -153,6 +153,8 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab
'mouseDown': draggableEvents.mouseDown, 'mouseDown': draggableEvents.mouseDown,
'mouseUp': draggableEvents.mouseUp, 'mouseUp': draggableEvents.mouseUp,
'mouseMove': draggableEvents.mouseMove, 'mouseMove': draggableEvents.mouseMove,
'keydown': draggableEvents.keyDown,
'keyup': draggableEvents.keyDown,
'checkLandingElement': draggableLogic.checkLandingElement, 'checkLandingElement': draggableLogic.checkLandingElement,
'checkIfOnTarget': draggableLogic.checkIfOnTarget, 'checkIfOnTarget': draggableLogic.checkIfOnTarget,
...@@ -181,8 +183,9 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab ...@@ -181,8 +183,9 @@ define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggab
'border-right: 1px solid #CCC; ' + 'border-right: 1px solid #CCC; ' +
'text-align: center; ' + 'text-align: center; ' +
'position: relative; ' + 'position: relative; ' +
'cursor: pointer; ' +
'" ' + '" ' +
'></div>' 'tabindex="0" aria-grabbed="false" role="listitem"></div>'
); );
draggableObj.containerEl.appendTo(state.sliderEl); draggableObj.containerEl.appendTo(state.sliderEl);
......
...@@ -117,7 +117,7 @@ define([], function () { ...@@ -117,7 +117,7 @@ define([], function () {
'color: #009fe2; ' + 'color: #009fe2; ' +
'cursor: pointer; ' + 'cursor: pointer; ' +
'" ' + '" ' +
'>0</div>' 'aria-dropeffect="move">0</div>'
); );
} else { } else {
numTextEl = null; numTextEl = null;
......
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