@@ -58,6 +58,7 @@ const Card = (stack, targetElement, prepend) => {
5858 let throwDirectionToEventName ;
5959 let throwOutDistance ;
6060 let throwWhere ;
61+ let appendedDuringMouseDown ;
6162
6263 const construct = ( ) => {
6364 card = { } ;
@@ -194,10 +195,16 @@ const Card = (stack, targetElement, prepend) => {
194195 } ) ( ) ;
195196 } else {
196197 targetElement . addEventListener ( 'mousedown' , ( ) => {
198+ appendedDuringMouseDown = Card . appendToParent ( targetElement ) || appendedDuringMouseDown ;
197199 eventEmitter . trigger ( 'panstart' ) ;
198200 } ) ;
199201
200202 targetElement . addEventListener ( 'mouseup' , ( ) => {
203+ if ( appendedDuringMouseDown ) {
204+ targetElement . click ( ) ;
205+ appendedDuringMouseDown = false ;
206+ }
207+
201208 if ( isDraging && ! isPanning ) {
202209 eventEmitter . trigger ( 'dragend' , {
203210 target : targetElement
@@ -453,11 +460,14 @@ Card.appendToParent = (element) => {
453460 const parentNode = element . parentNode ;
454461 const siblings = elementChildren ( parentNode ) ;
455462 const targetIndex = siblings . indexOf ( element ) ;
463+ const appended = targetIndex + 1 !== siblings . length ;
456464
457- if ( targetIndex + 1 !== siblings . length ) {
465+ if ( appended ) {
458466 parentNode . removeChild ( element ) ;
459467 parentNode . appendChild ( element ) ;
460468 }
469+
470+ return appended ;
461471} ;
462472
463473/**
0 commit comments