From 510b6443ba1eb36bb2e6f7e992044fd63ee83985 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 9 Oct 2019 18:28:50 -0400 Subject: [PATCH] generated docs: avoid clobbering browser shortcut keys --- lib/std/special/docs/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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();