Skip to main content

Search and Top Navigation

#15100 new bug ()

Opened November 18, 2016 02:27AM UTC

Last modified November 18, 2016 03:00AM UTC

Draggable: Cause focus and blur triggered every time when clicking the element

Reported by: flyoverL Owned by:
Priority: minor Milestone: none
Component: ui.draggable Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:
Description

jsBin: http://jsbin.com/qahiyib/2/edit?html,js,console,output

At the version 1.12.1,

Every time when clicking a draggable element, its focus event is always triggered.

Before the version 1.11.4,

Every time when clicking a draggable element, both focus and blur event are always triggered.

I think the following source of draggable in JqueryUi may cause this problem:

_mouseUp: function( event ) {
		this._unblockFrames();

		//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.dragStop(this, event);
		}

		var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );
		// Only need to focus if the event occurred on the draggable itself, see #10527
		//if ( this.handleElement.is( event.target ) ) {
		if (this.handleElement.is( event.target)) {
			// The interaction is over; whether or not the click resulted in a drag, focus the element
			this.element.focus();
		}

		return $.ui.mouse.prototype._mouseUp.call(this, event);
	}
Attachments (0)
Change History (1)

Changed November 18, 2016 03:00AM UTC by rjollos comment:1

description: jsBin: http://jsbin.com/qahiyib/2/edit?html,js,console,output \ \ At the version 1.12.1, \ Every time when clicking a draggable element, its focus event is always triggered. \ \ Before the version 1.11.4, \ Every time when clicking a draggable element, both focus and blur event are always triggered. \ \ I think the following source of draggable in JqueryUi may cause this problem: \ \ _mouseUp: function( event ) { \ this._unblockFrames(); \ \ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) \ if ( $.ui.ddmanager ) { \ $.ui.ddmanager.dragStop(this, event); \ } \ \ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); \ // Only need to focus if the event occurred on the draggable itself, see #10527 \ //if ( this.handleElement.is( event.target ) ) { \ if (this.handleElement.is( event.target)) { \ // The interaction is over; whether or not the click resulted in a drag, focus the element \ this.element.focus(); \ } \ \ return $.ui.mouse.prototype._mouseUp.call(this, event); \ }jsBin: http://jsbin.com/qahiyib/2/edit?html,js,console,output \ \ At the version 1.12.1, \ Every time when clicking a draggable element, its focus event is always triggered. \ \ Before the version 1.11.4, \ Every time when clicking a draggable element, both focus and blur event are always triggered. \ \ I think the following source of draggable in JqueryUi may cause this problem: \ \ {{{#!js \ _mouseUp: function( event ) { \ this._unblockFrames(); \ \ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) \ if ( $.ui.ddmanager ) { \ $.ui.ddmanager.dragStop(this, event); \ } \ \ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); \ // Only need to focus if the event occurred on the draggable itself, see #10527 \ //if ( this.handleElement.is( event.target ) ) { \ if (this.handleElement.is( event.target)) { \ // The interaction is over; whether or not the click resulted in a drag, focus the element \ this.element.focus(); \ } \ \ return $.ui.mouse.prototype._mouseUp.call(this, event); \ } \ }}}