hotkeys-js
hotkeys-js copied to clipboard
spaming ctrl with = or - triggers native browser zoom event
Steps to reproduce:
- use hotkey manager to set up hot keys for "ctrl+=" and "ctrl+-"
- in the application, hold "ctrl" and rapidly alternate between "=" and "-"
Observe: the native browser zoom event is triggered
Somehow this issue can't be reproduced in the demo.
Workaround for now:
window.addEventListener('keydown', e => {
if (e.ctrlKey) {
if (e.which === 187 || e.which === 189) {
e.preventDefault();
}
}
});
@achenPDFTron thx! I research your solution.
@jaywcjlove Thanks for taking the time to look into this problem.
i just found the solution! you should write:
hotkeys('ctrl+=', kv => {
kv.preventDefault()
....
})