From 0d09618865a938721ee35b5c91f41acd8f95cbb1 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 59c2c9e1cc..78281d60a6 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -1065,18 +1065,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; }