From bb2675a1eae31ad006888afd225d0b76824007a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Mo=CC=88ller?= Date: Tue, 6 Oct 2020 14:19:43 +0200 Subject: [PATCH] feat(selection): find react-flow parent from event target instead of document --- src/components/UserSelection/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/UserSelection/index.tsx b/src/components/UserSelection/index.tsx index e780e613..14a8a13a 100644 --- a/src/components/UserSelection/index.tsx +++ b/src/components/UserSelection/index.tsx @@ -12,7 +12,7 @@ type UserSelectionProps = { }; function getMousePosition(event: React.MouseEvent): XYPosition | void { - const reactFlowNode = document.querySelector('.react-flow'); + const reactFlowNode = (event.target as Element).closest('.react-flow'); if (!reactFlowNode) { return; }