microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.93k stars 29.52k forks source link

vscode keyboard shortcuts interfering with OS level shortcuts #234798

Open definitelycarter opened 4 days ago

definitelycarter commented 4 days ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.95.3 (Universal) Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Darwin arm64 24.1.0

In macOs Sequoia, there is "fn+ctrl+f" which takes the current window and 'fills' the screen.

Image

There are some scenarios where vscode is blocking this key bind from reaching the OS. The behavior is inconsistent and I can't track down the offending keyboard shortcut. I think this is a bug in vscode as the behavior is inconsistent and appears to depend on the state of the editor.

If this cannot be fixed in vscode could I please have guidance on how to find the keyboard shortcuts that are blocking this os level keyboard shortcut?

There are a number of ways to reproduce this - The simplest steps are:

  1. Open an empty file in the editor area
  2. Press "fn+ctrl+f"
    • Expected The window should fill the screen
    • Actual The window does not fill the screen
  3. Type the 'a' character
  4. Press "fn+ctrl+f"
    • Expected The window should fill the screen
    • Actual The window does not fill the screen
  5. Type the 'a' character
  6. Press "fn+ctrl+f"
    • Expected / Actual The window should fill the screen

Image

gjsjohnmurray commented 4 days ago

Does the guidance at https://github.com/microsoft/vscode/wiki/Keybinding-Issues help you diagnose the cause?

definitelycarter commented 4 days ago

Hi @gjsjohnmurray - Thank you for the link. I did some further debugging by trying out some of the suggestions in the basic troubleshooting section (for example try using key dispatch keyCode instead of code) and was unable to resolve the issue.

I did however, run the command Developer: Toggle Keyboard Shortcuts Troubleshooting and I did find some inconsistencies with the logs during my steps to reproduce.

Log Output on Step 2 & 4

With my steps to reproduce, when I pressed "fn+ctrl+f" the first two times. I noticed I had key binding set up for cursorRight. I disabled this keybinding; However, I got the same result.

Logs with keybinding set


2024-11-27 21:25:23.547 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-11-27 21:25:23.548 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-11-27 21:25:23.549 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2024-11-27 21:25:23.550 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2024-11-27 21:25:23.550 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-11-27 21:25:24.038 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-11-27 21:25:24.039 [info] [KeybindingService]: | Resolving ctrl+[KeyF]
2024-11-27 21:25:24.039 [info] [KeybindingService]: \ From 1 keybinding entries, matched cursorRight, when: textInputFocus, source: built-in.
2024-11-27 21:25:24.039 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: KeyF, keyCode: 70, key: f
2024-11-27 21:25:24.039 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyF, keyCode: 36 ('F')
2024-11-27 21:25:24.039 [info] [KeybindingService]: | Resolving ctrl+[KeyF]
2024-11-27 21:25:24.040 [info] [KeybindingService]: \ From 1 keybinding entries, matched cursorRight, when: textInputFocus, source: built-in.
2024-11-27 21:25:24.040 [info] [KeybindingService]: + Invoking command cursorRight.
2024-11-27 21:25:24.785 [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

Logs without keybinding set

This is the similar output above with one of the only differences being there is no keybinding command being invoked

2024-11-27 21:28:08.797 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-11-27 21:28:08.797 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-11-27 21:28:08.798 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2024-11-27 21:28:08.799 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2024-11-27 21:28:08.799 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-11-27 21:28:08.913 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-11-27 21:28:08.913 [info] [KeybindingService]: | Resolving ctrl+[KeyF]
2024-11-27 21:28:08.914 [info] [KeybindingService]: \ No keybinding entries.
2024-11-27 21:28:08.914 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: KeyF, keyCode: 70, key: f
2024-11-27 21:28:08.914 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyF, keyCode: 36 ('F')
2024-11-27 21:28:08.914 [info] [KeybindingService]: | Resolving ctrl+[KeyF]
2024-11-27 21:28:08.915 [info] [KeybindingService]: \ No keybinding entries.
2024-11-27 21:28:09.163 [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

Log Output on Step 6

This is very strange. When I pressed "fn+ctrl+f" on step 6, you can see the [KeyF] key did not get output in the logs here. Only ControlLeft.

My guess is because vscode didn't pick up the [KeyF] key, the macOS was able to pick up the event.

2024-11-27 21:26:16.034 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-11-27 21:26:16.065 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-11-27 21:26:16.065 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2024-11-27 21:26:16.066 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2024-11-27 21:26:16.066 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-11-27 21:26:16.318 [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.