chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 254 forks source link

hotkey with mod+w closes the browser tab #282

Closed bobharley closed 6 years ago

bobharley commented 6 years ago

It closes the browser tab even with e.preventDefault() and/or e.stopPropagation() Is there a way to override this behavior?

hotkeys.add({
  combo: 'mod+w',
  description: 'Close tab',
  allowIn: ['INPUT', 'SELECT', 'TEXTAREA'],
  callback: (e, hotkey) => {
    e.preventDefault()
    e.stopPropagation()
    // code here
  }
})
aramando commented 6 years ago

No. Browsers don't let you prevent users from closing tabs, windows or the browser application itself using keyboard shortcuts for security and usability reasons.