From 99175e78b04ed2d5b151fe6797ebf450ca76937c Mon Sep 17 00:00:00 2001 From: Asger F Date: Wed, 20 Nov 2024 14:48:46 +0100 Subject: [PATCH] Avoid resetting scroll position after clicking a node in the graph viewer --- extensions/ql-vscode/src/view/results/Graph.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/ql-vscode/src/view/results/Graph.tsx b/extensions/ql-vscode/src/view/results/Graph.tsx index 3f81f5d9b4f..0c82e41c008 100644 --- a/extensions/ql-vscode/src/view/results/Graph.tsx +++ b/extensions/ql-vscode/src/view/results/Graph.tsx @@ -48,7 +48,10 @@ export function Graph({ graphData, databaseUri }: GraphProps) { d.attributes["xlink:href"] = "#"; d.attributes["href"] = "#"; loc.uri = `file://${loc.uri}`; - select(this).on("click", () => jumpToLocation(loc, databaseUri)); + select(this).on("click", (event: Event) => { + jumpToLocation(loc, databaseUri); + event.preventDefault(); // Avoid resetting scroll position + }); } } if ("fill" in d.attributes) {