From 92d6e69b6e88fde73f8bf0be4656898ab28703a8 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Thu, 13 Mar 2025 20:33:12 -0700 Subject: [PATCH] citation dlg: fix collectionTree rendering (#5114) After switching from list mode to library mode if the selected collection row is close to the bottom. Fixes: #5104 --- chrome/content/zotero/integration/citationDialog.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index cc8e622150..0c8fe498e1 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -290,10 +290,13 @@ class Layout { if (this.forceUpdateTablesAfterRefresh && this.type == "library") { this.forceUpdateTablesAfterRefresh = false; setTimeout(() => { - libraryLayout.collectionsView?.tree.invalidate(); libraryLayout.itemsView.tree?.invalidate(); - libraryLayout.collectionsView?.tree.forceUpdate(); libraryLayout.itemsView.tree?.forceUpdate(); + // Necessary for the collectionTree to be properly rendered after switching to library mode + if (libraryLayout.collectionsView) { + let currentCollectionIndex = libraryLayout.collectionsView.tree.selection.focused; + libraryLayout.collectionsView.ensureRowIsVisible(currentCollectionIndex); + } }, 250); } }