question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preventing Google Chrome default shortcuts

See original GitHub issue

It is possible to prevent or override web browser sortcuts (ie Google Chrome) ? I’m trying to use v-shortkey="['ctrl', 'tab']" | | v-shortkey="['ctrl', 's']" but chrome shortcut fires.

Thank you.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jwheatpcommented, Jan 17, 2019

Hey, I managed to do it manually, here an example.

In your template :

<button v-shortkey="['meta', 'r']" @shortkey="run">

In your methods :

run: function(e) {
    if (e.ctrlKey || e.metaKey) {
        var c = e.which || e.keyCode; // get key code
        switch (c) {
            case 83: //block Ctrl+S
                e.preventDefault();     
            case 82: //block Ctrl+R
                e.preventDefault();     
            break;
        }
    }

  // do what you want
}

Inspired from : https://stackoverflow.com/a/24764878 Keycodes (like 83 and 82 above) can be get from https://keycode.info/.

1reaction
sarkirokacommented, Jan 11, 2019

Okay, I accept to cannot use “ctrl+tab” but I cannot use “alt-tab” or “shift+tab” or “ctrl+shift+tab” or “anything+tab” 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome keyboard shortcuts - Computer - Google Chrome Help
Windows & Linux ; Open Developer Tools, Ctrl + Shift + j or F12 ; Open the Clear Browsing Data options, Ctrl +...
Read more >
Preventing Google Chrome default shortcuts #71 - GitHub
In general, keyboard shortcuts using Alt only should be avoided on Mac, while shortcuts using Ctrl only should be avoided on Windows –...
Read more >
How to Disable Google Chrome Keyboard ... - Chrome Ready
Since there is no default way of disabling keyboard shortcuts in Google Chrome by yourself, we will have to rely on a Chrome...
Read more >
Disable keyboard shortcuts
Disable arbitrary keyboard shortcuts. Lets you set browser keyboard shortcuts containing Ctrl and Alt keys (Ctrl+S, Ctrl+P, Ctrl+Shift+C, ...
Read more >
How to Disable Google Chrome Keyboard ... - WindowsLoop
3. The above action will open the extensions settings panel. Here, type the shortcut you want to disable in the first field, select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found