diff --git a/k8s-manifest-builder/app.js b/k8s-manifest-builder/app.js index c75388f..6429c9e 100644 --- a/k8s-manifest-builder/app.js +++ b/k8s-manifest-builder/app.js @@ -963,6 +963,7 @@ const active = tab.dataset.sectionTarget === sectionNames[activeSection]; tab.classList.toggle("is-active", active); tab.setAttribute("aria-selected", String(active)); + tab.tabIndex = active ? 0 : -1; }); byId("previous-section").disabled = activeSection === 0; @@ -986,7 +987,9 @@ previousName = "web-app"; outputFormat = "yaml"; document.querySelectorAll(".format-button").forEach((button) => { - button.classList.toggle("is-active", button.dataset.format === "yaml"); + const active = button.dataset.format === "yaml"; + button.classList.toggle("is-active", active); + button.setAttribute("aria-pressed", String(active)); }); syncKindUI(); showSection(0); @@ -1060,17 +1063,34 @@ } }); - document.querySelectorAll(".section-tab").forEach((tab) => { + const sectionTabs = [...document.querySelectorAll(".section-tab")]; + sectionTabs.forEach((tab, index) => { tab.addEventListener("click", () => { showSection(sectionNames.indexOf(tab.dataset.sectionTarget)); }); + tab.addEventListener("keydown", (event) => { + let nextIndex; + if (event.key === "ArrowRight") nextIndex = (index + 1) % sectionTabs.length; + if (event.key === "ArrowLeft") { + nextIndex = (index - 1 + sectionTabs.length) % sectionTabs.length; + } + if (event.key === "Home") nextIndex = 0; + if (event.key === "End") nextIndex = sectionTabs.length - 1; + if (nextIndex === undefined) return; + + event.preventDefault(); + showSection(nextIndex); + sectionTabs[nextIndex].focus(); + }); }); document.querySelectorAll(".format-button").forEach((button) => { button.addEventListener("click", () => { outputFormat = button.dataset.format; document.querySelectorAll(".format-button").forEach((candidate) => { - candidate.classList.toggle("is-active", candidate === button); + const active = candidate === button; + candidate.classList.toggle("is-active", active); + candidate.setAttribute("aria-pressed", String(active)); }); render(); }); diff --git a/k8s-manifest-builder/index.html b/k8s-manifest-builder/index.html index ea5ef49..eac5c89 100644 --- a/k8s-manifest-builder/index.html +++ b/k8s-manifest-builder/index.html @@ -173,21 +173,62 @@

Workload settings

- - - -
-
+
01
@@ -256,7 +297,14 @@

Annotations

-