Commit 510b6443ba

Andrew Kelley <andrew@ziglang.org>
2019-10-10 00:28:50
generated docs: avoid clobbering browser shortcut keys
1 parent 000a1df
Changed files (1)
lib
std
special
docs
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();