From a0c0e3a126e93c02b0b48bbcdec7c874a867c82f Mon Sep 17 00:00:00 2001 From: hackademix Date: Thu, 10 Mar 2022 19:15:40 +0100 Subject: [PATCH] Fixed undefined lastInput on tab key. --- src/ui/ui.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/ui.js b/src/ui/ui.js index 5c2cf6e..9b119f4 100644 --- a/src/ui/ui.js +++ b/src/ui/ui.js @@ -572,8 +572,9 @@ var UI = (() => { setupCaps(perms, preset, row) { let immutable = Permissions.IMMUTABLE[preset.value] || {}; - let lastInput = null; - for (let input of this.rowTemplate._customizer.querySelectorAll("input")) { + let customizer = this.rowTemplate._customizer; + customizer.lastInput = null; + for (let input of customizer.querySelectorAll("input")) { let type = input.value; if (type in immutable) { input.disabled = true; @@ -581,7 +582,7 @@ var UI = (() => { } else { input.checked = perms.allowing(type); input.disabled = false; - lastInput = input; + customizer.lastInput = input; } input.parentNode.classList.toggle("needed", this.siteNeeds(row._site, type)); } @@ -681,7 +682,7 @@ var UI = (() => { if (e.shiftKey) return true; switch(e.code) { case "Tab": - if (document.activeElement === lastInput) { + if (document.activeElement === customizer.lastInput) { if (temp) { temp.tabIndex = "0"; temp.onblur = () => this.customize(null);