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; }