1

I'm building an Angular application and in my application, I have a feature of selecting multiple texts using Ctrl + mouse click on the word. The problem is if the user will press the Ctrl+ Tab doesn't matter if he has multiple tabs opened or not, the ctrl mouse-up event never fires and if I click on the word without ctrl press it selected the word with the previously selected word also. Is there any way I can block the Ctrl+Tab hotkey of the chrome browser in JavaScript?

  • 8
    No, you can't change how the browser works from a webpage. It seems like you should focus on fixing the problem, not trying to break browser behaviour to avoid it. – VLAZ Jul 01 '19 at 12:32
  • listen keypress event then you can find control tab – Khurshid Ansari Jul 01 '19 at 12:34
  • short answer: No, you can't. What you could do is listen to keypress. keyCode 9 is the tab. – Mario Jul 01 '19 at 12:45
  • @KhurshidAnsari It only detects key-down, not key-up – user11724099 Jul 01 '19 at 12:46
  • @Mario But, if I press Ctrl+Tab event never fire – user11724099 Jul 01 '19 at 12:47
  • you can listen to TAB, but CTRL+TAB is reserved. What you should do is listen to SHIFT+[KEY]. Or use a library for handling keyboard shortcuts (https://craig.is/killing/mice) Here is a list with reserved chrome shortcuts (https://support.google.com/chrome/answer/157179?hl=en) – Mario Jul 01 '19 at 13:20
  • And please use the SEARCH function, before asking general questions. https://stackoverflow.com/questions/24764626/any-way-to-prevent-disable-ctrl-key-shortcuts-in-the-browser – Mario Jul 01 '19 at 13:22

1 Answers1

0

Ctrl + tab is a browser functionality, there is no way you change the default behavior by your web page.

You can have this functionality if you create your own desktop application.

If you want that, I recommend you: Electron