@@ -291,7 +291,7 @@ test( "#8399: A draggable should become the active element after you are finishe
291
291
strictEqual ( document . activeElement , element . get ( 0 ) , "finishing moving a draggable anchor made it the active element" ) ;
292
292
} ) ;
293
293
294
- asyncTest ( "blur behavior" , function ( ) {
294
+ asyncTest ( "blur behavior - handle is main element " , function ( ) {
295
295
expect ( 3 ) ;
296
296
297
297
var element = $ ( "#draggable1" ) . draggable ( ) ,
@@ -315,6 +315,26 @@ asyncTest( "blur behavior", function() {
315
315
} ) ;
316
316
} ) ;
317
317
318
+ asyncTest ( "blur behavior - descendant of handle" , function ( ) {
319
+ expect ( 2 ) ;
320
+
321
+ var element = $ ( "#draggable2" ) . draggable ( { handle : "span" } ) ,
322
+
323
+ // The handle is a descendant, but we also want to grab a descendant of the handle
324
+ handle = element . find ( "span em" ) ,
325
+ focusElement = $ ( "<div tabindex='1'></div>" ) . appendTo ( element ) ;
326
+
327
+ testHelper . onFocus ( focusElement , function ( ) {
328
+ strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused before mousing down on a draggable" ) ;
329
+
330
+ testHelper . move ( handle , 50 , 50 ) ;
331
+
332
+ // Elements outside of the handle should blur (#12472, #14905)
333
+ notStrictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is no longer focused after mousing down on a draggable" ) ;
334
+ start ( ) ;
335
+ } ) ;
336
+ } ) ;
337
+
318
338
test ( "ui-draggable-handle assigned to appropriate element" , function ( assert ) {
319
339
expect ( 5 ) ;
320
340
0 commit comments