From 7cd57cd9e4e19ec51899293eca310ee075914b85 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Thu, 15 Sep 2022 11:53:11 +0300 Subject: [PATCH] Fix `focusContextPane` error when pressing tab in standalone PDF window Fixes #2823 --- chrome/content/zotero/xpcom/reader.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 006d9317fa..9335725c1f 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -1071,18 +1071,17 @@ class ReaderInstance { return; } case 'focusSplitButton': { - let win = Zotero.getMainWindow(); - if (win) { - win.document.getElementById('zotero-tb-toggle-item-pane').focus(); + if (this instanceof ReaderTab) { + let win = Zotero.getMainWindow(); + if (win) { + win.document.getElementById('zotero-tb-toggle-item-pane').focus(); + } } return; } case 'focusContextPane': { - let win = Zotero.getMainWindow(); - if (win) { - if (!this._window.ZoteroContextPane.focus()) { - this.focusFirst(); - } + if (this instanceof ReaderWindow || !this._window.ZoteroContextPane.focus()) { + this.focusFirst(); } return; }