omridevk / ng-keyboard-shortcuts

Dead Simple Keyboard Shortcuts Management for Angular

Home Page:https://ng-keyboard-shortcuts.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ctrl + t is not working

apaul76 opened this issue · comments

Hi ,

I am implementing

{
key: "ctrl + t",
label: "test",
description: "hello world",
command: () => console.log('directive cmd + e'),
preventDefault: true
}

inside the shortcuts array , but when pressing 'ctrl + t' it is opening a new tab in browser could you please help me with it, it would be great if you can provide me a working example

commented

Hi @avijitrockpaul
Thank you for reporting the issue, it is currently a known limitation:
#78
Can't seem to override the default behavior of this specific browser shortcut, I have checked with several shortcut libraries, like mousetrap and I don't remember the other one, but in both of them, you could not prevent default for ctrl/cmd + t and several others (ctrl/cmd + n)
I have tried to find a workaround but there does not seem to be one.
Maybe i'll revisit this later, closing as a limitation
and thanks again for reporting the issue :)
Hopefully you will still find it useful despite this limitation.

commented

@avijitrockpaul
last stackoverflow gives the most thorough answer:
https://stackoverflow.com/questions/7295508/javascript-capture-browser-shortcuts-ctrlt-n-w/10933700#10933700
With a list of shortcuts that cannot be captured via Javascript.

commented

@avijitrockpaul
Hi, my email is:
omrikatz12@gmail.com
Feel free to email me, i'll try to response as soon as possible.
Thank you.