- Edited
You can easily try the web version here: https://godot.toxe.net/bug_sticky_web_input/
This bug happens to me in Chrome and Edge (but not in Firefox) and is very easy to reproduce (I only tested on Windows 11):
- Press and keep holding cursor right, down and left. (WASD would also work.)
- Release in the same order right, down and left.
Now the left input key appears to be stuck because after releasing the right and down arrow keys a "left pressed" event will be send again. This happens when getting the input in a normal way with for example Input.get_vector()
and Input.is_action_pressed()
.
var bug_direction := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
update_labels(%BugDirection, %BugInput, bug_direction,
Input.is_action_pressed("ui_left"), Input.is_action_pressed("ui_right"),
Input.is_action_pressed("ui_up"), Input.is_action_pressed("ui_down"))
If you click on another frame or window you can see that the input status gets reset.
I also added a workaround that can deal with this issue.
I have recorded the bug two times in the following video. Also you can see how clicking on the console window/frame resets the input. (Sadly Youtube insisted that this had to be one of those annoying Shorts and I could not find a way to turn it into a sane video.)
You can find the project here: https://github.com/Toxe/godot-bug-sticky-web-input
And the main code here: https://github.com/Toxe/godot-bug-sticky-web-input/blob/master/main.gd