Merge pull request #2112 from ZhenShuo2021/fix/search-shortcut

🐛 Fix: disable the search keyboard shortcut in a form (#2041)
This commit is contained in:
Nuno Coração
2025-05-27 00:00:27 +01:00
committed by GitHub

View File

@@ -25,7 +25,14 @@ modal.addEventListener("click", function (event) {
document.addEventListener("keydown", function (event) {
// Forward slash to open search wrapper
if (event.key == "/") {
if (!searchVisible) {
const active = document.activeElement
const tag = active.tagName
const isInputField =
tag === "INPUT" ||
tag === "TEXTAREA" ||
active.isContentEditable
if (!searchVisible && !isInputField) {
event.preventDefault();
displaySearch();
}