-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chrome] Input actions get stuck in the pressed state on web builds #82732
Comments
I found similar/the same issue starting from 4.2dev4. After calling |
Got the same issue with 4.2-beta2 too |
Just tested it with 4.2-beta3 with my jam game - issue is still there unfortunately : /
In both cases bug was still replicable. It's sometimes very hard to get but it's happening frequently enough to make sharing jam games using web builds really risky. |
I can confirm this issue with Chromium on Linux X11. |
Well I don't know how to fix it, other than disabling #80859 in web builds. It's obviously a platform-specific issue. |
@Faless Any idea about what the Web platform does differently input wise which could introduce this discrepancy with other platforms? |
I have this issue on desktop (windows 10), so web is not the only affected platform. |
Can't reproduce on Windows 10, tried both minimal projects.
This is intended, you need to release the action for each press. Previously when you e.g. pressed action with keyboard and joypad, releasing only one released the action. This was fixed. |
We're also experiencing this. It doesn't happen in Firefox on Linux, but does in Edge and Opera GX on Windows 10, as well as in Chromium on Linux. It's pretty much a showstopper for us, and we're currently building a jam game with 4.2 beta4 since we are using @KoBeWi 's excellent Metroidvania System addon (as well as the new particles among other things). Let me know if I can help with the fix in any way. Otherwise we will compile our web export template without #80859 for now. |
@lemilonkh What I ended up doing in my jam game when I ran into this issue is simply to avoid using actions altogether. You can read key presses directly, for example using is_key_pressed(KEY_LEFT) instead of is_action_pressed("left"). It might be a suitable solution if you use simple controls, but YMMV. |
@nyxkn Thanks for the workaround. We might either do that or compile the export templates for web without the PR mentioned above. |
Testing with the following patch: diff --git a/platform/web/js/libs/library_godot_input.js b/platform/web/js/libs/library_godot_input.js
index 92113e85c9..c04403472c 100644
--- a/platform/web/js/libs/library_godot_input.js
+++ b/platform/web/js/libs/library_godot_input.js
@@ -454,6 +454,9 @@ const GodotInput = {
const modifiers = GodotInput.getModifiers(evt);
GodotRuntime.stringToHeap(evt.code, code, 32);
GodotRuntime.stringToHeap(evt.key, key, 32);
+ if (!evt.repeat) {
+ console.log(evt.code, pressed);
+ }
func(pressed, evt.repeat, modifiers);
evt.preventDefault();
} Here is the output from Firefox:
Here is the output from Chromium:
Seems like chrome is firing repeated Seems to be a browser bug. EDIT: Maybe this regression which regressed again? https://bugs.chromium.org/p/chromium/issues/detail?id=1069690 |
Indeed, it seems the regression was reintroduced in Chrome at some point. |
I've opened a new bug upstream: https://bugs.chromium.org/p/chromium/issues/detail?id=1500634 |
Godot version
master (a2f90d5)
System information
Godot v4.2.dev (a2f90d5) - Arch Linux #1 ZEN SMP PREEMPT_DYNAMIC Thu, 21 Sep 2023 12:54:31 +0000 - Tty - GLES3 (Compatibility) - AMD Radeon R9 380 Series (tonga, LLVM 16.0.6, DRM 3.54, 6.5.4-zen2-1-zen) () - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)
Issue description
Input actions get stuck in the pressed state even after releasing the action's key.
This happens only on web exports. I can reproduce the issue reliably on the latest Chrome/Chromium 117. It does not seem to happen on Firefox.
Steps to reproduce
It happens while pressing/releasing keys. One way I've found to reliably reproduce this issue is the following:
Assume we have 3 actions (A, B, C) with their respective keys assigned. Press and hold A, B and C, one after the other. I.e. press and hold A, then add B, then C. Now you're holding down three keys. Now, release the three keys in the same order they were pressed. I.e. release A, then release B, then release C. When you release key C, observe how is_key_pressed() for C returns false, but is_action_pressed() for C still returns true.
I've created a small test project with a basic character controller that moves with the built-in actions ui_{left,right,up,down}. The controller moves by reading the action pressed status with Input.get_vector(). Debug text shows the status of is_key_pressed and is_action_pressed.
To reproduce with this project, you can use any three of these direction keys to trigger the bug. E.g. press and hold left, down, right. Then release left, down, right. Observe how the character keeps moving right, and the action for right still shows as pressed (while the key doesn't).
vokoscreenNG-2023-10-03_16-37-59.mp4
Minimal reproduction project
bug-actions.zip
The text was updated successfully, but these errors were encountered: