You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When making a shortcut for a Button - the Pressed component of the event seems to be ignored. Meaning - a Button that should only be reacting to Release type events (an InputEventKey with presssed = false) will only fire on pressed = true, which doesn't properly match the kind of InputEventKey action it should.
What's worse - if you actually press the button, now it fires on Press AND Release of the shortcut. This doesn't feel like the expected behavior from the options available when building a Shortcut
Steps to reproduce
Create an empty project and make a Scene with only a Button
Add the below script to the button:
Add a Shortcut resource to the Button. Give it an InputEventAction and set the action to ui_accept. Leave pressed unchecked.
Make the Button big enough that you can click it in the running scene.
Run the scene and press the Enter key - you will notice that the event fires when the Enter key has been pressed, not when it is released
Use the Mouse to click the Button. At base settings, the press signal will fire on the release of the mouse button.
Now press the Enter key again - notice that now the pressed signal is firing not only on press, but also on release
This is not really a bug, button shortcuts are designed to fire only on press, see #71328
We could make Button respect action mode or shortcut's pressed flag, but the problem is that both default to "release", which would break editor shortcuts for the aforementioned reasons.
For now we can document it as intended behavior. Release shortcuts could be implemented as a separate flag, but it needs a proposal.
Godot version
4.0.1 stable
System information
Windows 10
Issue description
When making a shortcut for a
Button
- thePressed
component of the event seems to be ignored. Meaning - aButton
that should only be reacting toRelease
type events (an InputEventKey withpresssed = false
) will only fire onpressed = true
, which doesn't properly match the kind ofInputEventKey
action it should.What's worse - if you actually press the button, now it fires on
Press
ANDRelease
of the shortcut. This doesn't feel like the expected behavior from the options available when building aShortcut
Steps to reproduce
Create an empty project and make a Scene with only a Button
Add the below script to the button:
Add a
Shortcut
resource to theButton
. Give it anInputEventAction
and set the action toui_accept
. Leavepressed
unchecked.Make the
Button
big enough that you can click it in the running scene.Run the scene and press the
Enter
key - you will notice that the event fires when theEnter
key has beenpressed
, not when it isreleased
Use the Mouse to click the
Button
. At base settings, the press signal will fire on therelease
of the mouse button.Now press the
Enter
key again - notice that now thepressed
signal is firing not only onpress
, but also onrelease
Minimal reproduction project
ShortcutBug.zip
The text was updated successfully, but these errors were encountered: