mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-23 22:45:14 +00:00
fix for 's' keypress in search, and escape behaviour to reset sidebar elements
This commit is contained in:
parent
34f56371f7
commit
17aac69d92
1 changed files with 7 additions and 1 deletions
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
// Capture '/' keypress for quick search
|
// Capture '/' keypress for quick search
|
||||||
window.addEventListener("keyup", (e) => {
|
window.addEventListener("keyup", (e) => {
|
||||||
if (e.key === "s") {
|
if (e.key === "s" && document.activeElement !== searchBox) {
|
||||||
e.preventDefault;
|
e.preventDefault;
|
||||||
searchBox.focus();
|
searchBox.focus();
|
||||||
searchBox.value = "";
|
searchBox.value = "";
|
||||||
|
@ -55,7 +55,13 @@
|
||||||
|
|
||||||
if (e.key === "Escape" && document.activeElement === searchBox) {
|
if (e.key === "Escape" && document.activeElement === searchBox) {
|
||||||
e.preventDefault;
|
e.preventDefault;
|
||||||
|
|
||||||
|
// De-focus input box
|
||||||
searchBox.blur();
|
searchBox.blur();
|
||||||
|
|
||||||
|
// Reset sidebar state
|
||||||
|
search();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue