Merge pull request #43113 from intrip/hide-guides-with-escape

Close guides dropdown with Escape keypress
This commit is contained in:
Rafael França 2021-09-20 16:17:29 -04:00 committed by GitHub
commit 7f593b6052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,12 @@
});
});
document.addEventListener("keyup", function(e) {
if (e.key === "Escape" && guides.classList.contains("visible")) {
guides.classList.remove("visible");
}
});
var guidesIndexItem = document.querySelector("select.guides-index-item");
var currentGuidePath = window.location.pathname;
guidesIndexItem.value = currentGuidePath.substring(currentGuidePath.lastIndexOf("/") + 1);