From 21ca1555c13ea1e926f28e19f931e405fa3a4cff Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 31 Jan 2022 19:44:13 +0200 Subject: [PATCH] Focus tag input field if tagsBox doesn't have tags Fixes #2315 --- chrome/content/zotero/bindings/tagsbox.xml | 6 +++++- chrome/content/zotero/xpcom/reader.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/bindings/tagsbox.xml b/chrome/content/zotero/bindings/tagsbox.xml index 0a5edc33cb..67f74ba1f5 100644 --- a/chrome/content/zotero/bindings/tagsbox.xml +++ b/chrome/content/zotero/bindings/tagsbox.xml @@ -782,7 +782,11 @@ } var row = this.addDynamicRow(); - row.firstChild.nextSibling.click(); + // It needs relatively high delay to make focus-on-click work + setTimeout(() => { + row.firstChild.nextSibling.click(); + }, 50); + return row; ]]> diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 7e452d9873..7c241a7ae0 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -376,6 +376,9 @@ class ReaderInstance { menupopup.openPopupAtScreen(x, y, false); tagsbox.mode = 'edit'; tagsbox.item = item; + if (tagsbox.mode == 'edit' && tagsbox.count == 0) { + tagsbox.newTag(); + } } _openPagePopup(data) {