Mouse: Don't stop propagation of mouseup

Fixes #10818
This commit is contained in:
Hannah Methvin 2015-10-18 12:36:43 -04:00
parent ac81e39237
commit a1d69208ba
3 changed files with 20 additions and 3 deletions

View File

@ -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" ); 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 );
} );
} ); } );

View File

@ -255,7 +255,7 @@ $.widget( "ui.draggable", $.ui.mouse, {
if ( !noPropagation ) { if ( !noPropagation ) {
var ui = this._uiHash(); var ui = this._uiHash();
if ( this._trigger( "drag", event, ui ) === false ) { if ( this._trigger( "drag", event, ui ) === false ) {
this._mouseUp( {} ); this._mouseUp( new $.Event( "mouseup", event ) );
return false; return false;
} }
this.position = ui.position; this.position = ui.position;
@ -322,7 +322,7 @@ $.widget( "ui.draggable", $.ui.mouse, {
cancel: function() { cancel: function() {
if ( this.helper.is( ".ui-draggable-dragging" ) ) { if ( this.helper.is( ".ui-draggable-dragging" ) ) {
this._mouseUp( {} ); this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
} else { } else {
this._clear(); this._clear();
} }

View File

@ -189,7 +189,7 @@ return $.widget( "ui.mouse", {
} }
mouseHandled = false; mouseHandled = false;
return false; event.preventDefault();
}, },
_mouseDistanceMet: function( event ) { _mouseDistanceMet: function( event ) {