From a5eb5a5af5c8047b66c1afd52a2406b4e1d0dda4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 24 Sep 2015 06:46:02 -0400 Subject: [PATCH] Scroll collection into view on collection-containing-an-item --- chrome/content/zotero/xpcom/collectionTreeView.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 3d0c85364..cc9af03de 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -384,10 +384,17 @@ Zotero.CollectionTreeView.prototype.setHighlightedRows = function (ids) { this._highlightedRows = {}; this._treebox.invalidate(); + var scrolled = false; for each(var id in ids) { + let row = this._collectionRowMap[id]; this.expandToCollection(id); - this._highlightedRows[this._collectionRowMap[id]] = true; - this._treebox.invalidateRow(this._collectionRowMap[id]); + // TODO: Scroll a little above or below + if (!scrolled) { + this._treebox.ensureRowIsVisible(row); + scrolled = true; + } + this._highlightedRows[row] = true; + this._treebox.invalidateRow(row); } }