aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-05-05 09:29:21 -0400
committerScott González <scott.gonzalez@gmail.com>2016-02-09 13:37:26 -0500
commit63c103dd540897c9df0c064da36e5cf40b824518 (patch)
treef07d274ba7d2b836c600eabb52705aff74e46bc0 /ui
parent8fc3ba22ba12fe5f3c579db53c3c8da0a68ac16d (diff)
downloadjquery-ui-63c103dd540897c9df0c064da36e5cf40b824518.tar.gz
jquery-ui-63c103dd540897c9df0c064da36e5cf40b824518.zip
Draggable: Improve detection for when to blur the active element
Fixes #12472 Fixes #14905 Closes gh-1548
Diffstat (limited to 'ui')
-rw-r--r--ui/widgets/draggable.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/widgets/draggable.js b/ui/widgets/draggable.js
index 7da09b7ec..32bf861ed 100644
--- a/ui/widgets/draggable.js
+++ b/ui/widgets/draggable.js
@@ -143,14 +143,19 @@ $.widget( "ui.draggable", $.ui.mouse, {
},
_blurActiveElement: function( event ) {
-
- // Only need to blur if the event occurred on the draggable itself, see #10527
- if ( !this.handleElement.is( event.target ) ) {
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
+ target = $( event.target );
+
+ // Only blur if the event occurred on an element that is:
+ // 1) within the draggable handle
+ // 2) but not within the currently focused element
+ // See #10527, #12472
+ if ( this._getHandle( event ) && target.closest( activeElement ).length ) {
return;
}
// Blur any element that currently has focus, see #4261
- $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
+ $.ui.safeBlur( activeElement );
},
_mouseStart: function( event ) {