@@ -123,9 +123,14 @@ $.widget("ui.draggable", $.ui.mouse, {
123
123
124
124
} ,
125
125
126
- _blurActiveElement : function ( ) {
126
+ _blurActiveElement : function ( event ) {
127
127
var document = this . document [ 0 ] ;
128
128
129
+ // Only need to blur if the event occurred on the draggable itself, see #10527
130
+ if ( ! this . handleElement . is ( event . target ) ) {
131
+ return ;
132
+ }
133
+
129
134
// support: IE9
130
135
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
131
136
try {
@@ -134,12 +139,8 @@ $.widget("ui.draggable", $.ui.mouse, {
134
139
// If the <body> is blurred, IE will switch windows, see #9520
135
140
if ( document . activeElement && document . activeElement . nodeName . toLowerCase ( ) !== "body" ) {
136
141
137
- // Only need to blur if the event occurred on the draggable, see #10527
138
- if ( this . handleElement . is ( event . target ) ) {
139
-
140
- // Blur any element that currently has focus, see #4261
141
- $ ( document . activeElement ) . blur ( ) ;
142
- }
142
+ // Blur any element that currently has focus, see #4261
143
+ $ ( document . activeElement ) . blur ( ) ;
143
144
}
144
145
} catch ( error ) { }
145
146
} ,
@@ -289,7 +290,7 @@ $.widget("ui.draggable", $.ui.mouse, {
289
290
return false ;
290
291
} ,
291
292
292
- _mouseUp : function ( event ) {
293
+ _mouseUp : function ( event ) {
293
294
//Remove frame helpers
294
295
$ ( "div.ui-draggable-iframeFix" ) . each ( function ( ) {
295
296
this . parentNode . removeChild ( this ) ;
@@ -300,8 +301,11 @@ $.widget("ui.draggable", $.ui.mouse, {
300
301
$ . ui . ddmanager . dragStop ( this , event ) ;
301
302
}
302
303
303
- // The interaction is over; whether or not the click resulted in a drag, focus the element
304
- this . element . focus ( ) ;
304
+ // Only need to focus if the event occurred on the draggable itself, see #10527
305
+ if ( this . handleElement . is ( event . target ) ) {
306
+ // The interaction is over; whether or not the click resulted in a drag, focus the element
307
+ this . element . focus ( ) ;
308
+ }
305
309
306
310
return $ . ui . mouse . prototype . _mouseUp . call ( this , event ) ;
307
311
} ,
0 commit comments