godot icon indicating copy to clipboard operation
godot copied to clipboard

Keyboard shortcuts should either not be consumed or not allow conflicts

Open michaelgundlach opened this issue 3 years ago • 3 comments

Godot version

4.0 beta 4

System information

MacOS 12.3.1

Issue description

Half the time I use a keyboard shortcut in Godot (3 or 4), it doesn't work because I have the Script Editor focused and it consumes the shortcut. The other half of the time it seems something else I've focused consumes the shortcut :) . [Examples: #61782, #56961]

Yet Godot ships with these overlapping shortcuts which then fail to work as advertised.

To fix this we should do one of the following:

  1. Allow shortcuts to trigger all mapped actions and provide a warning when mapping to an existing shortcut (like other IDEs e.g. VSCode do).
  2. Prevent conflicting shortcuts from existing if both contexts could be simultaneously active (e.g. Script Editor and general IDE shortcuts).

Whichever one gets implemented, the default shortcuts should then be updated to not conflict to adhere to the Principle Of Least Astonishment.

Steps to reproduce

  1. Open a script in an existing project.
  2. Focus the Script Editor.
  3. Press Command+Comma or Command+B on mac.

Expected behavior: Editor Settings opens or the project plays, respectively. Actual result: Nothing (or probably something to do with breakpoints or bookmarks)

Minimal reproduction project

No response

michaelgundlach avatar Nov 01 '22 15:11 michaelgundlach

This is also related to #66678 and #63888.

There is a deeper harder to solve issue here with option (alt) or shift-based shortcuts, since these also map to typed characters and it's hard to know the user intention. In this case I think I think it's probably better still to have the input go to the current active field editor as it does now, to avoid the #66678 type case where the user will trigger a shortcut unexpectedly trying to typ common special characters.

However, there's currently a serious usability issue in 4.0.beta5 where command- (and I assume control-) modifier key events are also being used as field input. This might mean the field doesn't consume the event, or that the shortcut trigger doesn't consume the event, but it ends up triggering both. This I would argue is never the user intention, and key events with command or control modifiers should never be used as text input. This is very confusing since the shortcut (like Command-S to save) is triggered but what you don't notice is that you've also renamed the selected node to "s" or changed the color in the open color picker to "s" (which turns it black when you close the color picker).

lostminds avatar Nov 21 '22 09:11 lostminds

Allow shortcuts to trigger all mapped actions and provide a warning when mapping to an existing shortcut (like other IDEs e.g. VSCode do).

VS Code warns you about duplicates - but it does not trigger all actions assigned to that shortcut. Assigning shortcuts to actions which can be triggered under the same conditions still only triggers one of the actions. Warning about duplicates is fine, and a good thing that could potentially be added. I don't think triggering all mapped actions is.

Prevent conflicting shortcuts from existing if both contexts could be simultaneously active (e.g. Script Editor and general IDE shortcuts).

Shortcuts don't have awareness of what 'context' they are assigned to. In 4.0 you can set a 'shortcut context' for specific controls, which says 'for control X only execute X's shortcuts if the focus is within control Y', where Y can be X itself. Having shortcuts be aware of this context at the time they are assigned in the shortcut editor dialog is a much bigger change and would likely need changes to the core of how shortcuts work (or some sort of specific EditorShortcut implementation?).

EricEzaM avatar Nov 28 '22 12:11 EricEzaM

I have a similar issue on Linux (Ubuntu) regarding shortcuts and them being overloaded in the 3D Editor when you use a GridMap. In the 3D editor for Godot 4.0.beta6 (which is great btw!) you should be able to change the plane of a GridMap with E and Q according to the editor (see the Screenshot). image but instead you activate Select Mode (Q) or Rotate Mode (E) instead because they share the same shortcut. You could of course change the Shortcut in your project, but by this level of integration I would expect that an extra button like alt, ctrl, ... or just another key except E and Q would be used by standard. Is this related to the issue of @michaelgundlach ?

IPDramon avatar Dec 05 '22 21:12 IPDramon