diff --git a/src/js/popup.js b/src/js/popup.js index c159451..cf45c49 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -615,8 +615,6 @@ Logic.registerPanel(P_CONTAINERS_LIST, { currentPage.prepend(favIconElement); const currentContainer = document.getElementById("current-container"); - const DefaultText =document.getElementById("default-text"); - const DefaultBox =document.getElementById("container-page-assigned"); currentContainer.innerText = identity.name; if (identity.name === "Default"){ document.getElementById("container-page-assigned-label").style.display = "none"; @@ -894,8 +892,7 @@ Logic.registerPanel(P_CONTAINERS_EDIT, { tr.querySelector(".container-name").textContent = identity.name; tr.querySelector(".edit-container").setAttribute("title", `Edit ${identity.name} container`); tr.querySelector(".remove-container").setAttribute("title", `Remove ${identity.name} container`); - tr.setAttribute("tabindex","0"); - + Logic.addEnterHandler(tr, e => { if (e.target.matches(".edit-container-icon") || e.target.parentNode.matches(".edit-container-icon")) { Logic.showPanel(P_CONTAINER_EDIT, identity); @@ -909,45 +906,8 @@ Logic.registerPanel(P_CONTAINERS_EDIT, { list.innerHTML = ""; list.appendChild(fragment); - list.addEventListener("keydown", (e) => { - console.log("hi"); - const selectables = [...document.querySelectorAll("[tabindex='0'], [tabindex='-1']")]; - console.log(selectables[0].innerHTML); - const element = document.activeElement; - const index = selectables.indexOf(element) || 0; - function next() { - const nextElement = selectables[index + 1]; - if (nextElement) { - nextElement.focus(); - } - } - function previous() { - const previousElement = selectables[index - 1]; - if (previousElement) { - previousElement.focus(); - } - } - switch (e.keyCode) { - case 40: - next(); - break; - case 38: - previous(); - break; - default: - if ((e.keyCode >= 49 && e.keyCode <= 57) && - Logic._currentPanel === "containersEdit") { - const element = selectables[e.keyCode - 48]; - if (element) { - element.click(); - } - } - break; - } - }); return Promise.resolve(null); }, - }); // P_CONTAINER_EDIT: Editor for a container. @@ -1081,7 +1041,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, { templateInstance.innerHTML = iconRadioTemplate(containerIcon); iconRadioFieldset.appendChild(templateInstance); }); - }, + },P_CONTAINERS_EDIT // This method is called when the panel is shown. async prepare() {