Quick answer: Set button.shortcut_context to a parent Control that holds focus. The shortcut fires when focus is anywhere in that subtree. Use a Shortcut resource with an InputEventAction.
A Save button has Ctrl-S as a shortcut. Press it; nothing happens. Focus is on a text field elsewhere; the shortcut path doesn’t reach the button.
The Symptom
BaseButton.shortcut set, key combo doesn’t trigger pressed signal. Clicking the button works.
The Fix
SaveButton:
shortcut: ShortcutResource (Ctrl+S)
shortcut_context: $MenuBar # or parent that owns focus
Make a Shortcut resource:
ShortcutResource (.tres):
events: [InputEventKey { ctrl_pressed = true, keycode = KEY_S }]
Or better, an InputEventAction reference so rebinds propagate.
Focus Behavior
When focus is in any descendant of shortcut_context, the shortcut fires. If shortcut_context is empty, only direct focus on the button itself triggers.
Verifying
Click into a text field within the menu bar. Press Ctrl-S. Save action should fire. Click outside the menu bar; press Ctrl-S; nothing fires.
“Context defines scope. Resource defines combo. Shortcut works.”
Related Issues
For Control mouse_filter, see mouse filter. For input deadzone, see deadzone.
Context plus shortcut. Right scope.