@@ -44,6 +44,8 @@ export default class MouseBackend {
44
44
this . handleWindowMoveCapture . bind ( this )
45
45
this . handleWindowMoveEndCapture =
46
46
this . handleWindowMoveEndCapture . bind ( this )
47
+ this . handleWindowClick =
48
+ this . handleWindowClick . bind ( this )
47
49
}
48
50
49
51
setup ( ) {
@@ -64,6 +66,8 @@ export default class MouseBackend {
64
66
this . handleWindowMoveCapture , true )
65
67
window . addEventListener ( 'mouseup' ,
66
68
this . handleWindowMoveEndCapture , true )
69
+ window . addEventListener ( 'click' ,
70
+ this . handleWindowClick , true )
67
71
}
68
72
69
73
getSourceClientOffset ( sourceId ) {
@@ -86,6 +90,8 @@ export default class MouseBackend {
86
90
'mousemove' , this . handleWindowMoveCapture , true )
87
91
window . removeEventListener (
88
92
'mouseup' , this . handleWindowMoveEndCapture , true )
93
+ window . removeEventListener (
94
+ 'click' , this . handleWindowClick , true )
89
95
}
90
96
91
97
connectDragSource ( sourceId , node ) {
@@ -187,6 +193,7 @@ export default class MouseBackend {
187
193
this . moveStartSourceIds = null
188
194
return
189
195
}
196
+ this . preventClick = true
190
197
191
198
e . preventDefault ( )
192
199
@@ -197,6 +204,11 @@ export default class MouseBackend {
197
204
this . actions . endDrag ( )
198
205
}
199
206
207
+ handleWindowClick ( e ) {
208
+ if ( this . preventClick ) e . stopPropagation ( )
209
+ this . preventClick = false
210
+ }
211
+
200
212
installSourceNodeRemovalObserver ( node ) {
201
213
this . uninstallSourceNodeRemovalObserver ( )
202
214
0 commit comments