Fix key events in the search box

This commit is contained in:
KatieFrogs 2022-02-25 21:57:10 +03:00
parent 6a9139f9e9
commit 7935b3685f
2 changed files with 8 additions and 2 deletions

View File

@ -68,7 +68,11 @@ class Keyboard{
}
keyEvent(event){
var key = event.key.toLowerCase()
if(
if(event.target.tagName === "INPUT"){
if(key === "escape"){
event.preventDefault()
}
}else if(
key === "escape" ||
key === "backspace" ||
key === "tab" ||

View File

@ -94,8 +94,10 @@ class PageEvents{
}
if(this.kbd.indexOf(event.key.toLowerCase()) !== -1){
this.lastKeyEvent = Date.now()
if(event.target.tagName !== "INPUT"){
event.preventDefault()
}
}
this.keyListeners.forEach(addedKeyCode => {
this.checkListener(addedKeyCode.get("all"), event)
this.checkListener(addedKeyCode.get(event.keyCode), event)