Conflicts with browser shortcuts

Is there a way to override the browser shortcuts, in particular ctrl-w? Ctrl-w closes the tab which closes VS code completely, rather than closing the one tab in VS Code. That’ll be a hard one to stop using.

1 Like

I just did a quick search and I found this (I assume you mean Virtual Studio Code?)

I’m not looking for vs code bindings, I’m wondering if it’s possible to override browser bindings (per the question).

Ctrl+w is not a shortcut browsers allow to override. :frowning:

If you go into full screen mode (Run the VS Code Toggle Full Screen command or press F11), then you can use Ctrl+w (and other browser blocked shortcuts) and it will work as expected.

1 Like

That’s a good tip, but if a user is in full screen mode and casually tries to close an editor tab, it’s still super painful to accidentally close the whole session, especially since it can take a bit for the page/session to reload. I think trying to give a warning before closing the whole editor might be helpful.

Unfortunately, it doesn’t even get to the JavaScript handler - potentially intentionally for security reasons and run away scripts since this is one of the only ways to shut down something that’s going crazy.

Seems like a feature the chrome devs could add to allow specific sites to override ctrl-w, kind of like you can allow extensions to only work on specific sites.

Appears you can at least warn users before closing based on this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=935594

While not great, would be a lot better than closing with no warning.