diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-10-09 18:28:50 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-10-09 18:28:50 -0400 |
| commit | 510b6443ba1eb36bb2e6f7e992044fd63ee83985 (patch) | |
| tree | d5f211f62f4442f87917fe691edf1cac4f7671ae /lib | |
| parent | 000a1df4a31eb04012d8c1f0bd3bff7815e19a03 (diff) | |
| download | zig-510b6443ba1eb36bb2e6f7e992044fd63ee83985.tar.gz zig-510b6443ba1eb36bb2e6f7e992044fd63ee83985.zip | |
generated docs: avoid clobbering browser shortcut keys
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/special/docs/main.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js index b99321788c..532c6f3349 100644 --- a/lib/std/special/docs/main.js +++ b/lib/std/special/docs/main.js @@ -1074,6 +1074,8 @@ function onSearchKeyDown(ev) { switch (ev.which) { case 13: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; + // detect if this search changes anything var terms1 = getSearchTerms(); startSearch(); @@ -1087,6 +1089,8 @@ ev.stopPropagation(); return; case 27: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; + domSearch.value = ""; domSearch.blur(); curSearchIndex = -1; @@ -1095,16 +1099,22 @@ startSearch(); return; case 38: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; + moveSearchCursor(-1); ev.preventDefault(); ev.stopPropagation(); return; case 40: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; + moveSearchCursor(1); ev.preventDefault(); ev.stopPropagation(); return; default: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; + curSearchIndex = -1; ev.stopPropagation(); startAsyncSearch(); @@ -1134,6 +1144,7 @@ function onWindowKeyDown(ev) { switch (ev.which) { case 27: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; if (!domHelpModal.classList.contains("hidden")) { domHelpModal.classList.add("hidden"); ev.preventDefault(); @@ -1141,6 +1152,7 @@ } break; case 83: + if (ev.shiftKey || ev.ctrlKey || ev.altKey) return; domSearch.focus(); domSearch.select(); ev.preventDefault(); @@ -1148,6 +1160,7 @@ startAsyncSearch(); break; case 191: + if (!ev.shiftKey || ev.ctrlKey || ev.altKey) return; ev.preventDefault(); ev.stopPropagation(); showHelpModal(); |
