Merge pull request #4267 from lukewilliamboswell/main

roc docs add feature to focus search box using ⌘F, CTRL F, or F3
This commit is contained in:
Richard Feldman 2022-10-09 00:20:53 -07:00 committed by GitHub
commit 04bceae956
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,4 +44,21 @@
searchBox.addEventListener("input", search);
search();
// Capture '/' keypress for quick search
window.addEventListener("keyup", (e) => {
if (e.code === "Slash") {
e.preventDefault;
searchBox.focus();
searchBox.value = "";
}
if (e.code === "Escape" && document.activeElement === searchBox) {
e.preventDefault;
searchBox.blur();
}
});
})();