From a334d9fdd8fe154aea3d989e8c849f1210030cc3 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 9 Jul 2024 10:32:33 -0400 Subject: [PATCH] Item box: Use startsWith, not includes, for field name checks --- chrome/content/zotero/elements/itemBox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index f5d5278ccc..42fee937d3 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -2103,7 +2103,7 @@ } // The creator row is dropped before a non-creator row, meaning it's moved below // all other creators - else if (!beforeCreatorField.includes("creator-")) { + else if (!beforeCreatorField.startsWith("creator-")) { beforeCreatorIndex = this.item.numCreators(); } // Creator row is placed before another creator @@ -2261,7 +2261,7 @@ let refocusField = this.querySelector(`#${CSS.escape(this._selectField)}:not([disabled="true"])`); // For creator rows, if a focusable node with desired id does not exist, try to focus // the same component from the last available creator row - if (!refocusField && this._selectField.includes("creator")) { + if (!refocusField && this._selectField.startsWith("creator-")) { let maybeLastCreatorID = this._selectField.replace(/\d+/g, Math.max(this._creatorCount - 1, 0)); refocusField = this.querySelector(`#${CSS.escape(maybeLastCreatorID)}`); }