From 08626c7a2d4eca3e725e82865f5a94c699fb0208 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Mon, 10 Mar 2025 05:57:16 +0000 Subject: [PATCH] when a user clicks on a source, don't swap focus --- src/public/app/widgets/llm_chat_panel.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/llm_chat_panel.ts b/src/public/app/widgets/llm_chat_panel.ts index 03ca036cd..40f176e8c 100644 --- a/src/public/app/widgets/llm_chat_panel.ts +++ b/src/public/app/widgets/llm_chat_panel.ts @@ -313,7 +313,12 @@ export default class LlmChatPanel extends BasicWidget { // Add click handler for better user experience sourceElement.querySelector('.source-link')?.addEventListener('click', (e) => { e.preventDefault(); - appContext.tabManager.openTabWithNoteWithHoisting(source.noteId); + e.stopPropagation(); + + // Open the note in a new tab but don't switch to it + appContext.tabManager.openTabWithNoteWithHoisting(source.noteId, { activate: false }); + + return false; // Additional measure to prevent the event from bubbling up }); this.sourcesList.appendChild(sourceElement);