Permalink
Browse files

Mouse: Don't stop propagation of mouseup

Fixes #10818
  • Loading branch information...
1 parent ac81e39 commit a1d69208bad175a27c7b50c27fdc10001563cd4d @hmethvin hmethvin committed Oct 18, 2015
Showing with 20 additions and 3 deletions.
  1. +17 −0 tests/unit/draggable/core.js
  2. +2 −2 ui/widgets/draggable.js
  3. +1 −1 ui/widgets/mouse.js
@@ -345,4 +345,21 @@ test( "ui-draggable-handle managed correctly in nested draggables", function( as
assert.hasClasses( child, "ui-draggable-handle", "child retains class name on destroy" );
} );
+test( "does not stop propagation to window", function( assert ) {
+ expect( 1 );
+ var element = $( "#draggable1" ).draggable();
+
+ var handler = function() {
+ assert.ok( true, "mouseup propagates to window" );
+ };
+ $( window ).on( "mouseup", handler );
+
+ element.simulate( "drag", {
+ dx: 10,
+ dy: 10
+ } );
+
+ $( window ).off( "mouseup", handler );
+} );
+
} );
@@ -255,7 +255,7 @@ $.widget( "ui.draggable", $.ui.mouse, {
if ( !noPropagation ) {
var ui = this._uiHash();
if ( this._trigger( "drag", event, ui ) === false ) {
- this._mouseUp( {} );
+ this._mouseUp( new $.Event( "mouseup", event ) );
return false;
}
this.position = ui.position;
@@ -322,7 +322,7 @@ $.widget( "ui.draggable", $.ui.mouse, {
cancel: function() {
if ( this.helper.is( ".ui-draggable-dragging" ) ) {
- this._mouseUp( {} );
+ this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
} else {
this._clear();
}
View
@@ -189,7 +189,7 @@ return $.widget( "ui.mouse", {
}
mouseHandled = false;
- return false;
+ event.preventDefault();
},
_mouseDistanceMet: function( event ) {

0 comments on commit a1d6920

Please sign in to comment.