From ac9e882bda2ae7743ce5ab26f257ab44d14e6964 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 10 Jun 2022 13:59:01 -0500 Subject: [PATCH] fx-compat: Item box: Fix URL opening and field blurring --- chrome/content/zotero/elements/itemBox.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index 85ff4dfbf0..746e16bc25 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -560,7 +560,7 @@ && Zotero.Utilities.isHTTPURL(val, true)) { th.classList.add("pointer"); // TODO: make getFieldValue non-private and use below instead - th.setAttribute("onclick", "Zotero.launchURL(this.nextSibling.firstChild ? this.nextSibling.firstChild.textContent : this.nextSibling.value)"); + th.setAttribute("onclick", "Zotero.launchURL(this.nextSibling.firstChild.value || this.nextSibling.firstChild.textContent)"); th.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); } else if (fieldName == 'DOI' && val && typeof val == 'string') { @@ -593,8 +593,8 @@ th.classList.add("pointer"); } th.addEventListener('click', function () { - if (this.nextSibling.inputField) { - this.nextSibling.inputField.blur(); + if (this.nextSibling.querySelector('input, textarea')) { + this.nextSibling.querySelector('input, textarea').blur(); } else { this.getRootNode().host.toggleAbstractExpand( @@ -604,8 +604,11 @@ }); } else { - th.setAttribute("onclick", - "if (this.nextSibling.inputField) { this.nextSibling.inputField.blur(); }"); + th.addEventListener('click', function () { + if (this.nextSibling.querySelector('input, textarea')) { + this.nextSibling.querySelector('input, textarea').blur(); + } + }); } let td = document.createElement('td');