From 080ada78eea782176e5e9e4f10b17be9d1f4ea08 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 4 Aug 2022 17:20:01 -0400 Subject: [PATCH] fx-compat: Item box: Prevent tabbing to hidden firstName --- chrome/content/zotero/elements/itemBox.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index dd7bc8dd6b..a4e8cb4422 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -2233,7 +2233,9 @@ if (back) { Zotero.debug('Looking for previous tabindex before ' + tabindex, 4); for (let i = tabbableFields.length - 1; i >= 0; i--) { - if (parseInt(tabbableFields[i].getAttribute('ztabindex')) < tabindex) { + let field = tabbableFields[i]; + let tabIndexHere = parseInt(field.getAttribute('ztabindex')); + if (tabIndexHere !== -1 && tabIndexHere < tabindex) { next = tabbableFields[i]; break; } @@ -2242,7 +2244,9 @@ else { Zotero.debug('Looking for tabindex ' + tabindex, 4); for (var pos = 0; pos < tabbableFields.length; pos++) { - if (parseInt(tabbableFields[pos].getAttribute('ztabindex')) >= tabindex) { + let field = tabbableFields[pos]; + let tabIndexHere = parseInt(field.getAttribute('ztabindex')); + if (tabIndexHere !== -1 && tabIndexHere >= tabindex) { next = tabbableFields[pos]; break; }