aboutsummaryrefslogtreecommitdiff
path: root/lib/docs
diff options
context:
space:
mode:
authorCarl Ã…stholm <carl@astholm.se>2024-03-12 19:54:49 +0100
committerAndrew Kelley <andrew@ziglang.org>2024-03-13 18:37:00 -0700
commit2008b14bc76b54f29b07e8570a094c17aefea9d5 (patch)
tree5dd07cbefb19a37813f5edb576a45453389d5128 /lib/docs
parent7a858257f2c05f0ab8df0debda9f1d58b5ecf251 (diff)
downloadzig-2008b14bc76b54f29b07e8570a094c17aefea9d5.tar.gz
zig-2008b14bc76b54f29b07e8570a094c17aefea9d5.zip
autodoc: Use `code` for keyboard events
Diffstat (limited to 'lib/docs')
-rw-r--r--lib/docs/main.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/docs/main.js b/lib/docs/main.js
index bdcb465440..d9888eac68 100644
--- a/lib/docs/main.js
+++ b/lib/docs/main.js
@@ -666,8 +666,8 @@
}
function onSearchKeyDown(ev) {
- switch (ev.which) {
- case 13:
+ switch (ev.code) {
+ case "Enter":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
clearAsyncSearch();
@@ -677,7 +677,7 @@
ev.preventDefault();
ev.stopPropagation();
return;
- case 27:
+ case "Escape":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
domSearch.value = "";
@@ -687,14 +687,14 @@
ev.stopPropagation();
startSearch();
return;
- case 38:
+ case "ArrowUp":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
moveSearchCursor(-1);
ev.preventDefault();
ev.stopPropagation();
return;
- case 40:
+ case "ArrowDown":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
moveSearchCursor(1);
@@ -732,8 +732,8 @@
}
function onWindowKeyDown(ev) {
- switch (ev.which) {
- case 27:
+ switch (ev.code) {
+ case "Escape":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
if (!domHelpModal.classList.contains("hidden")) {
domHelpModal.classList.add("hidden");
@@ -741,7 +741,7 @@
ev.stopPropagation();
}
break;
- case 83:
+ case "KeyS":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
domSearch.focus();
domSearch.select();
@@ -749,13 +749,13 @@
ev.stopPropagation();
startAsyncSearch();
break;
- case 85:
+ case "KeyU":
if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
ev.preventDefault();
ev.stopPropagation();
navigateToSource();
break;
- case 191:
+ case "Slash":
if (!ev.shiftKey || ev.ctrlKey || ev.altKey) return;
ev.preventDefault();
ev.stopPropagation();