mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(key) chrome keydown event double pass
This commit is contained in:
parent
7c52d622ba
commit
86417d4781
1 changed files with 11 additions and 2 deletions
|
|
@ -40,7 +40,7 @@ function KeyProto() {
|
|||
};
|
||||
|
||||
this.bind = () => {
|
||||
Events.addKey(listener);
|
||||
Events.addKey(listener, true);
|
||||
Binded = true;
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +57,16 @@ function KeyProto() {
|
|||
}
|
||||
|
||||
function listener(event) {
|
||||
const {keyCode} = event;
|
||||
const {body} = document;
|
||||
const {
|
||||
keyCode,
|
||||
target,
|
||||
} = event;
|
||||
|
||||
// chrome double event pass
|
||||
if (target != body)
|
||||
return;
|
||||
|
||||
const alt = event.altKey;
|
||||
const ctrl = event.ctrlKey;
|
||||
const shift = event.shiftKey;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue