From b05ef8ed0450fb3c0bc9412ee414b1dee469b291 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Fri, 18 Aug 2023 18:30:06 +0200 Subject: [PATCH] Properly focus reader iframe when opening a new reader instance --- chrome/content/zotero/xpcom/reader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 22a95215b3..e9b36f7fad 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -86,6 +86,11 @@ class ReaderInstance { return this._type; } + async focus() { + await this._waitForReader(); + this._iframeWindow.focus(); + } + getSecondViewState() { let state = this._iframeWindow.wrappedJSObject.getSecondViewState(); return state ? JSON.parse(JSON.stringify(state)) : undefined; @@ -1441,7 +1446,7 @@ class Reader { } if (!openInBackground) { - reader._window.focus(); + reader.focus(); } return reader; }