aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/draggable.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/ui/draggable.js b/ui/draggable.js
index 3cae40f11..98f065efb 100644
--- a/ui/draggable.js
+++ b/ui/draggable.js
@@ -123,9 +123,14 @@ $.widget("ui.draggable", $.ui.mouse, {
},
- _blurActiveElement: function() {
+ _blurActiveElement: function( event ) {
var document = this.document[ 0 ];
+ // Only need to blur if the event occurred on the draggable itself, see #10527
+ if ( !this.handleElement.is( event.target ) ) {
+ return;
+ }
+
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
@@ -134,12 +139,8 @@ $.widget("ui.draggable", $.ui.mouse, {
// If the <body> is blurred, IE will switch windows, see #9520
if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
- // Only need to blur if the event occurred on the draggable, see #10527
- if ( this.handleElement.is( event.target ) ) {
-
- // Blur any element that currently has focus, see #4261
- $( document.activeElement ).blur();
- }
+ // Blur any element that currently has focus, see #4261
+ $( document.activeElement ).blur();
}
} catch ( error ) {}
},
@@ -289,7 +290,7 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
},
- _mouseUp: function(event) {
+ _mouseUp: function( event ) {
//Remove frame helpers
$("div.ui-draggable-iframeFix").each(function() {
this.parentNode.removeChild(this);
@@ -300,8 +301,11 @@ $.widget("ui.draggable", $.ui.mouse, {
$.ui.ddmanager.dragStop(this, event);
}
- // The interaction is over; whether or not the click resulted in a drag, focus the element
- this.element.focus();
+ // Only need to focus if the event occurred on the draggable itself, see #10527
+ 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);
},