@@ -291,7 +291,7 @@ test( "#8399: A draggable should become the active element after you are finishe
291291 strictEqual ( document . activeElement , element . get ( 0 ) , "finishing moving a draggable anchor made it the active element" ) ;
292292} ) ;
293293
294- asyncTest ( "blur behavior" , function ( ) {
294+ asyncTest ( "blur behavior - handle is main element " , function ( ) {
295295 expect ( 3 ) ;
296296
297297 var element = $ ( "#draggable1" ) . draggable ( ) ,
@@ -315,6 +315,26 @@ asyncTest( "blur behavior", function() {
315315 } ) ;
316316} ) ;
317317
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+
318338test ( "ui-draggable-handle assigned to appropriate element" , function ( assert ) {
319339 expect ( 5 ) ;
320340
0 commit comments