diff --git a/public/app/plugins/panel/nodeGraph/Node.tsx b/public/app/plugins/panel/nodeGraph/Node.tsx index aec7b7ced9f..a95b5c687ad 100644 --- a/public/app/plugins/panel/nodeGraph/Node.tsx +++ b/public/app/plugins/panel/nodeGraph/Node.tsx @@ -32,6 +32,7 @@ const getStyles = (theme: GrafanaTheme2, hovering: HoverState) => ({ text: css` fill: ${theme.colors.text.primary}; + pointer-events: none; `, titleText: css` @@ -57,6 +58,12 @@ const getStyles = (theme: GrafanaTheme2, hovering: HoverState) => ({ background-color: ${tinycolor(theme.colors.background.primary).setAlpha(0.8).toHex8String()}; } `, + + clickTarget: css` + fill: none; + stroke: none; + pointer-events: fill; + `, }); export const Node = memo(function Node(props: { @@ -76,24 +83,11 @@ export const Node = memo(function Node(props: { } return ( - { - onMouseEnter(node.id); - }} - onMouseLeave={() => { - onMouseLeave(node.id); - }} - onClick={(event) => { - onClick(event, node); - }} - aria-label={`Node: ${node.title}`} - > + {isHovered && } - + + { + onMouseEnter(node.id); + }} + onMouseLeave={() => { + onMouseLeave(node.id); + }} + onClick={(event) => { + onClick(event, node); + }} + className={styles.clickTarget} + x={node.x - nodeR - 5} + y={node.y - nodeR - 5} + width={nodeR * 2 + 10} + height={nodeR * 2 + 50} + /> ); }); diff --git a/public/app/plugins/panel/nodeGraph/NodeGraph.test.tsx b/public/app/plugins/panel/nodeGraph/NodeGraph.test.tsx index 340827d6b2b..6b1f3939bc0 100644 --- a/public/app/plugins/panel/nodeGraph/NodeGraph.test.tsx +++ b/public/app/plugins/panel/nodeGraph/NodeGraph.test.tsx @@ -89,7 +89,7 @@ describe('NodeGraph', () => { const origError = console.error; console.error = jest.fn(); - const node = await screen.findByLabelText(/Node: service:0/); + const node = await screen.findByTestId('node-click-rect-0'); await userEvent.click(node); await screen.findByText(/Node traces/); diff --git a/public/app/plugins/panel/nodeGraph/useContextMenu.tsx b/public/app/plugins/panel/nodeGraph/useContextMenu.tsx index b9d71f3ca98..cc99319ffa2 100644 --- a/public/app/plugins/panel/nodeGraph/useContextMenu.tsx +++ b/public/app/plugins/panel/nodeGraph/useContextMenu.tsx @@ -232,12 +232,12 @@ function EdgeHeader(props: { edge: EdgeDatum; edges: DataFrame }) { const rows = []; if (valueSource && valueTarget) { - rows.push(); + rows.push(); } for (const f of [fields.mainStat, fields.secondaryStat, ...fields.details]) { if (f && f.values[index]) { - rows.push(); + rows.push(); } }