Fixed undefined lastInput on tab key.

This commit is contained in:
hackademix 2022-03-10 19:15:40 +01:00
parent 993eb6a73e
commit a0c0e3a126
1 changed files with 5 additions and 4 deletions

View File

@ -572,8 +572,9 @@ var UI = (() => {
setupCaps(perms, preset, row) { setupCaps(perms, preset, row) {
let immutable = Permissions.IMMUTABLE[preset.value] || {}; let immutable = Permissions.IMMUTABLE[preset.value] || {};
let lastInput = null; let customizer = this.rowTemplate._customizer;
for (let input of this.rowTemplate._customizer.querySelectorAll("input")) { customizer.lastInput = null;
for (let input of customizer.querySelectorAll("input")) {
let type = input.value; let type = input.value;
if (type in immutable) { if (type in immutable) {
input.disabled = true; input.disabled = true;
@ -581,7 +582,7 @@ var UI = (() => {
} else { } else {
input.checked = perms.allowing(type); input.checked = perms.allowing(type);
input.disabled = false; input.disabled = false;
lastInput = input; customizer.lastInput = input;
} }
input.parentNode.classList.toggle("needed", this.siteNeeds(row._site, type)); input.parentNode.classList.toggle("needed", this.siteNeeds(row._site, type));
} }
@ -681,7 +682,7 @@ var UI = (() => {
if (e.shiftKey) return true; if (e.shiftKey) return true;
switch(e.code) { switch(e.code) {
case "Tab": case "Tab":
if (document.activeElement === lastInput) { if (document.activeElement === customizer.lastInput) {
if (temp) { if (temp) {
temp.tabIndex = "0"; temp.tabIndex = "0";
temp.onblur = () => this.customize(null); temp.onblur = () => this.customize(null);