Skip to content

Build your personal knowledge base with Trilium Notes

when a user clicks on a source, don't swap focus

perf3ct08626c7a2d4e
diff --git a/src/public/app/widgets/llm_chat_panel.ts b/src/public/app/widgets/llm_chat_panel.ts
index 03ca036cd1..40f176e8cc 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);