jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.66k stars 410 forks source link

Blocking the browser default event failed #374

Open xuhuihui opened 2 years ago

xuhuihui commented 2 years ago

Question:When you press Command+C, then release C, press S, you will call the browser default event. Expect:Whenever you press Command + S, invoke the registered event. Demo:https://codepen.io/hui-h-i/pen/bGLorEK

hotkeys('command+s', { keydown: true, element: document.body, }, (event) => { event.preventDefault(); console.log('a ctrl up'); });