microsoft/vscode

Mac OS X "Invalid key shortcut sound" on ⌃⌘↓

Closed this issue · 11 comments

  • VSCode Version: 1.20.1
  • OS Version: 10.11.6

Steps to Reproduce:

  1. Press ⌃⌘↓ in the text editor. The "invalid key shortcut" sound will be played. (This is also the case for ⌃⌘← and ⌃⌘→.
  2. Press ⌃⌘↑. The "invalid key shortcut" sound will not be played.

There's clearly something going funny here, because up and down have different behaviour. These sounds play even if they are valid key shortcuts.

Yeah this also affects move to next/previous terminal pane keys I found recently.

Both Electron and Chromium issues were closed as won't fix 😢 https://bugs.chromium.org/p/chromium/issues/detail?id=916460

FYI for anyone else stumbling into this.

The workaround given in the upstream Chromium issue is to setup key bindings at the OS-level that are just noops.

$ mkdir -p ~/Library/KeyBindings
$ cat > ~/Library/KeyBindings/DefaultKeyBinding.dict <<EOF
{
  "^@\UF701" = "noop";
  "^@\UF702" = "noop";
  "^@\UF703" = "noop";
}
EOF

Then restart the affected apps.

Updated FAQ in terminal to include the workaround, thanks! microsoft/vscode-docs#4395

so is this an issue with whatever upstream codebase vscode depends on? I get this annoying beeping sound every time I move a line down via a keyboard shortcut.

so is this an issue with whatever upstream codebase vscode depends on?

Yes. This is an issue in Chromium and thus Electron. The upstream bugs in both Chromium and Electron have been closed as "won't fix."

Is this workaround no longer working for anyone else on macOS 14.4? Two machines, same effect and same keys as original report (i.e. ⌃⌘↑ is fine).

I think this bug came back after a few years

Here is the new workaround from the upstream Electron bug:

{
    "@^\UF700" = "noop:";
    "@^\UF701" = "noop:";
    "@^\UF702" = "noop:";
    "@^\UF703" = "noop:";
    "@~^\UF700" = "noop:";
    "@~^\UF701" = "noop:";
    "@~^\UF702" = "noop:";
    "@~^\UF703" = "noop:";
}

Basically, you needed to add the : at the end of noop, and the order of the modifier symbols is different.

I've included the codes for cmd-ctrl-arrow and cmd-opt-ctrl-arrow above.

The codes for the up arrow (700) are probably not needed.

Details for what these codes mean are at: https://gist.github.com/trusktr/1e5e516df4e8032cbc3d

I'm AFK, so I haven't tested this yet.

This is working great for me on two 14.4 Macs.