diff --git a/.changeset/shaggy-penguins-invite.md b/.changeset/shaggy-penguins-invite.md new file mode 100644 index 00000000..bfc28607 --- /dev/null +++ b/.changeset/shaggy-penguins-invite.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Prevent pane click event when connection is in progress. diff --git a/packages/core/src/container/Pane/Pane.vue b/packages/core/src/container/Pane/Pane.vue index 35936554..621b36c3 100644 --- a/packages/core/src/container/Pane/Pane.vue +++ b/packages/core/src/container/Pane/Pane.vue @@ -32,6 +32,7 @@ const { nodeLookup, connectionLookup, defaultEdgeOptions, + connectionStartHandle, } = useVueFlow() const container = ref(null) @@ -44,6 +45,8 @@ const containerBounds = ref() const hasActiveSelection = toRef(() => elementsSelectable.value && (isSelecting || userSelectionActive.value)) +const connectionInProgress = toRef(() => connectionStartHandle.value !== null) + // Used to prevent click events when the user lets go of the selectionKey during a selection let selectionInProgress = false let selectionStarted = false @@ -79,7 +82,7 @@ function wrapHandler(handler: Function, containerRef: HTMLDivElement | null) { } function onClick(event: MouseEvent) { - if (selectionInProgress) { + if (selectionInProgress || connectionInProgress) { selectionInProgress = false return }