diff --git a/chrome/content/zotero/elements/attachmentBox.js b/chrome/content/zotero/elements/attachmentBox.js index 7d2af9320c..3d9a6f6363 100644 --- a/chrome/content/zotero/elements/attachmentBox.js +++ b/chrome/content/zotero/elements/attachmentBox.js @@ -263,6 +263,8 @@ reindexButton.click(); } }); + + this.querySelectorAll(".meta-label").forEach(label => label.addEventListener("click", this._handleMetaLabelClick)); } destroy() { @@ -622,6 +624,16 @@ await this.item.saveTx(); } + _handleMetaLabelClick = (event) => { + let labelWrapper = event.target.closest(".meta-label"); + if (labelWrapper.nextSibling.contains(document.activeElement)) { + document.activeElement.blur(); + } + else if (!labelWrapper.nextSibling.firstChild.readOnly) { + labelWrapper.nextSibling.firstChild.focus(); + } + }; + _id(id) { return this.querySelector(`#${id}`); }