From 587ae6ba7e50fa52323fdf5891ae4239b965a767 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 21 Jun 2022 03:03:18 -0400 Subject: [PATCH] fx-compat: Fix blurring of textarea fields in item box And fix tests --- chrome/content/zotero/elements/itemBox.js | 2 +- test/tests/zoteroPaneTest.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index 1053a44bd0..85b6f4ba95 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -2293,7 +2293,7 @@ blurOpenField() { return (async function () { - var activeField = this._infoTable.querySelector('input'); + var activeField = this._infoTable.querySelector('input, textarea'); if (!activeField) { return false; } diff --git a/test/tests/zoteroPaneTest.js b/test/tests/zoteroPaneTest.js index 6f552027a0..defb69e390 100644 --- a/test/tests/zoteroPaneTest.js +++ b/test/tests/zoteroPaneTest.js @@ -19,7 +19,7 @@ describe("ZoteroPane", function() { it("should create an item and focus the title field", function* () { yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true); var itemBox = doc.getElementById('zotero-editpane-item-box'); - var textboxes = doc.getAnonymousNodes(itemBox)[0].getElementsByTagName('textbox'); + var textboxes = itemBox.shadowRoot.querySelectorAll('input, textarea'); assert.lengthOf(textboxes, 1); assert.equal(textboxes[0].getAttribute('fieldname'), 'title'); textboxes[0].blur(); @@ -30,7 +30,7 @@ describe("ZoteroPane", function() { var value = "Test"; var item = yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true); var itemBox = doc.getElementById('zotero-editpane-item-box'); - var textbox = doc.getAnonymousNodes(itemBox)[0].getElementsByTagName('textbox')[0]; + var textbox = itemBox.shadowRoot.querySelector('textarea'); textbox.value = value; yield itemBox.blurOpenField(); item = yield Zotero.Items.getAsync(item.id);