From 753032a001995e7b6a25b3bb65b23cc1764b28e7 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Thu, 20 Mar 2025 14:20:22 -0700 Subject: [PATCH] citation dlg: highlight bubble when table focused (#5142) In library mode, apply highlighting to bubbles that correspond to selected items in itemTree only when the items table is focused. When the focus leaves, highlighting is removed from bubbles. Fixes: #5138 --- chrome/content/zotero/integration/citationDialog.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index 0fb8380149..2005cf1018 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -533,6 +533,10 @@ class LibraryLayout extends Layout { itemsTree.addEventListener("mousemove", event => this._handleItemsViewMouseMove(event)); // handle backspace to remove an item from citation itemsTree.addEventListener("keypress", event => this._handleItemsViewKeyPress(event)); + // only highlight bubbles of selected rows when the focus is in itemTree + // when focus leaves the items table, bubbles highlighting is removed + itemsTree.addEventListener("focusin", this.updateSelectedItems); + itemsTree.addEventListener("focusout", this._clearSelectedBubbles); this._refreshItemsViewHighlightedRows(); } @@ -692,6 +696,14 @@ class LibraryLayout extends Layout { rowAfterRefresh.closest(".virtualized-table-body").scrollTop += delta; } } + + // remove selected highlight from all bubbles + _clearSelectedBubbles() { + for (let itemObj of CitationDataManager.items) { + itemObj.selected = false; + } + IOManager.updateBubbleInput(); + } } class ListLayout extends Layout {