v0.36.23
This commit is contained in:
1 parent
668c908abb
commit
76f42b5864
30 files changed
+191
-72
No files matched your search
@@ -150,6 +150,13 @@
|
||||
button.dataset.i18n = key;
|
||||
button.setAttribute("role", "tab");
|
||||
button.addEventListener("click", () => activateTab(name));
|
||||
button.addEventListener("keydown", event => {
|
||||
const buttons = [...tabs.querySelectorAll("button")], index = buttons.indexOf(button); let next;
|
||||
if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % buttons.length;
|
||||
else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + buttons.length - 1) % buttons.length;
|
||||
else if (event.key === "Home") next = 0; else if (event.key === "End") next = buttons.length - 1; else return;
|
||||
event.preventDefault(); activateTab(buttons[next].dataset.tab); buttons[next].focus();
|
||||
});
|
||||
tabs.append(button);
|
||||
}
|
||||
activateTab("general");
|
||||
|
||||
Reference in new issue
Block a user