mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
Fix key events in the search box
This commit is contained in:
parent
6a9139f9e9
commit
7935b3685f
@ -68,7 +68,11 @@ class Keyboard{
|
|||||||
}
|
}
|
||||||
keyEvent(event){
|
keyEvent(event){
|
||||||
var key = event.key.toLowerCase()
|
var key = event.key.toLowerCase()
|
||||||
if(
|
if(event.target.tagName === "INPUT"){
|
||||||
|
if(key === "escape"){
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
}else if(
|
||||||
key === "escape" ||
|
key === "escape" ||
|
||||||
key === "backspace" ||
|
key === "backspace" ||
|
||||||
key === "tab" ||
|
key === "tab" ||
|
||||||
|
@ -94,8 +94,10 @@ class PageEvents{
|
|||||||
}
|
}
|
||||||
if(this.kbd.indexOf(event.key.toLowerCase()) !== -1){
|
if(this.kbd.indexOf(event.key.toLowerCase()) !== -1){
|
||||||
this.lastKeyEvent = Date.now()
|
this.lastKeyEvent = Date.now()
|
||||||
|
if(event.target.tagName !== "INPUT"){
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.keyListeners.forEach(addedKeyCode => {
|
this.keyListeners.forEach(addedKeyCode => {
|
||||||
this.checkListener(addedKeyCode.get("all"), event)
|
this.checkListener(addedKeyCode.get("all"), event)
|
||||||
this.checkListener(addedKeyCode.get(event.keyCode), event)
|
this.checkListener(addedKeyCode.get(event.keyCode), event)
|
||||||
|
Loading…
Reference in New Issue
Block a user