Skip to content

Commit

Permalink
MDL-44042 Javascript: Handle moving to the top of the current section…
Browse files Browse the repository at this point in the history
… with keyboard
  • Loading branch information
andrewnicols committed Feb 13, 2014
1 parent 974c2cd commit 2ab0238
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
Expand Up @@ -507,6 +507,15 @@ Y.extend(DRAGDROP, Y.Base, {
// Simulate the full sequence.
this.drag_start(dragevent);
this.global_drop_over(dropevent);

if (droptarget.hasClass(this.parentnodeclass) && droptarget.contains(dragcontainer)) {
// The global_drop_over function does not handle the case where an item was moved up, without the
// 'goingup' variable being set, as is the case wih keyboard drag/drop. We must detect this case and
// apply it after the drop_over, but before the drop_hit event in order for it to be moved to the
// correct location.
droptarget.prepend(dragcontainer);
}

this.global_drop_hit(dropevent);
M.core.dragdrop.keydraghandle.focus();
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js
Expand Up @@ -507,6 +507,15 @@ Y.extend(DRAGDROP, Y.Base, {
// Simulate the full sequence.
this.drag_start(dragevent);
this.global_drop_over(dropevent);

if (droptarget.hasClass(this.parentnodeclass) && droptarget.contains(dragcontainer)) {
// The global_drop_over function does not handle the case where an item was moved up, without the
// 'goingup' variable being set, as is the case wih keyboard drag/drop. We must detect this case and
// apply it after the drop_over, but before the drop_hit event in order for it to be moved to the
// correct location.
droptarget.prepend(dragcontainer);
}

this.global_drop_hit(dropevent);
M.core.dragdrop.keydraghandle.focus();
},
Expand Down
9 changes: 9 additions & 0 deletions lib/yui/src/dragdrop/js/dragdrop.js
Expand Up @@ -505,6 +505,15 @@ Y.extend(DRAGDROP, Y.Base, {
// Simulate the full sequence.
this.drag_start(dragevent);
this.global_drop_over(dropevent);

if (droptarget.hasClass(this.parentnodeclass) && droptarget.contains(dragcontainer)) {
// The global_drop_over function does not handle the case where an item was moved up, without the
// 'goingup' variable being set, as is the case wih keyboard drag/drop. We must detect this case and
// apply it after the drop_over, but before the drop_hit event in order for it to be moved to the
// correct location.
droptarget.prepend(dragcontainer);
}

this.global_drop_hit(dropevent);
M.core.dragdrop.keydraghandle.focus();
},
Expand Down

0 comments on commit 2ab0238

Please sign in to comment.