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; }