hotkeys-js icon indicating copy to clipboard operation
hotkeys-js copied to clipboard

seperate each hotkey event calls using same shortcut keys

Open ladypython247 opened this issue 2 years ago • 1 comments

I have two div A and div B I want to add same keyboard shortcuts, ctrl+up and ctrl+down works alright, but the problem begins when I navigate with the arrow (hotkeys shortcut) it logs both shortcut key ctrl+up in div a and div b. How do I avoid this.

hotkeys('left', 'forms', function(handler, event) {
 if(handler.shortcut=="ctrl+down"){
console.log("left", "down")
}if(handler.shortcut=="ctrl+up"){
console.log("left", "up")
}
});


hotkeys('right', 'files', function(handler, event) {
 if(event.shortcut=="ctrl+down"){
console.log("right", "down")
}if(event.shortcut=="ctrl+up"){
console.log("right", "up")
}
});

This is my example code. I have looked at the setScope still don't how to apply it to the code above.

ladypython247 avatar Feb 10 '22 11:02 ladypython247

I can not reappear this problem. Could you offer a online example. For example this.

Yukiniro avatar Feb 19 '22 06:02 Yukiniro