diff --git a/chrome/content/zotero/components/windowed-list.js b/chrome/content/zotero/components/windowed-list.js index 08cae8f707..28ed3d78c1 100644 --- a/chrome/content/zotero/components/windowed-list.js +++ b/chrome/content/zotero/components/windowed-list.js @@ -164,7 +164,7 @@ module.exports = class { * @param scrollOffset {Integer} offset for the top of the tree */ scrollTo(scrollOffset) { - const maxOffset = this.itemHeight * this._getItemCount() - this.getWindowHeight(); + const maxOffset = Math.max(0, this.itemHeight * this._getItemCount() - this.getWindowHeight()); scrollOffset = Math.min(Math.max(0, scrollOffset), maxOffset); this.scrollOffset = scrollOffset; this.targetElement.scrollTop = scrollOffset; diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 5c53a1898b..2692eab432 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1021,6 +1021,8 @@ var ItemTree = class ItemTree extends LibraryTree { } this.forceUpdate(() => { this.selection.selectEventsSuppressed = false; + // Reset scrollbar to top + this._treebox && this._treebox.scrollTo(0); this._updateIntroText(); this._itemTreeLoadingDeferred.resolve(); });