-
Notifications
You must be signed in to change notification settings - Fork 432
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
Fixed bug causing focus to be lost when pressing TAB. #2812
Fixed bug causing focus to be lost when pressing TAB. #2812
Conversation
I feel like I remember something like that happening before, and that can honestly be a bit of a pet peeve to people, so this is a good change ngl (I don't understand why it wasn't added sooner) |
nice I'll try this out today |
@Geokureli Reworked the PR to cleanup style changes and only include the fix on Windows (where the bug is known to occur). |
Thanks, I still need to test this on my windows pc. Also when i press tab on mac it just crashes (tried on dev, btw) Was gonna see why, and see if this fixes that |
linking this as it seems related: |
@@ -119,6 +119,9 @@ class Console extends Window | |||
{ | |||
if (FlxG.debugger.visible && FlxG.game.debugger.console.visible && e.keyCode == Keyboard.TAB) | |||
FlxG.stage.focus = input; | |||
#if windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicky, I know but please put an empty line above here. I always try to put one empty after an if's block
#if windows | |
#if windows |
Also I tried these steps on my windows pc (without your changes):
the "actual behavior" you describe doesn't happen for me, not sure if it's because it's windows 11, I can try my win10 pc. But the system mouse appears when i press "~" revealing the debug menu, not when i press tab. My game doesn't lose focus in any way, i'm still able to control it. |
I wasn't seeing the issue because I didn't have hscript installed. with hscript installed I now see that pressing tab is a way to select the console input, which seems to pause the game. Unfortunately this change doesn't prevent that, and even clicking the console field pauses the game |
To clarify on the symptoms If the debug menu is open, pressing TAB switches focus to the text field for the console. If the debug menu is CLOSED, pressing TAB seems to switch focus to the inactive element causing focus to detach from Flixel entirely. Pausing the game while in the debug view and typing in console seems to be the default and intended behavior to prevent inputs from affecting the game |
I tried this as well, and saw no issue on any of my machines. maybe it's because I didn't create any textFields? could you try this in a new, small project and see if it still happens? and can you elaborate on the symptoms, more? FYI, I know this is a real issue, we had to change a hotkey in our editor from tab because people were having issues. I just can't merge anything until I know what's happening. I also want to test FlxInputText to see if this effects that |
I thought #2760 fixed this issue |
@EliteMasterEric can you try and confirm that the issue is still happening to you on the latest release? not sure if you made this branch based on your experiences prior to upgrading to flixel 5.3. especially since I cannot reproduce the error |
It looks like I was on an old branch and hadn't fast-forwarded. The issue appears to be resolved now. |
Thanks for clearing things up @NeeEoo |
The associated bug can be reproduced in this way:
TAB
.Expected behavior is that nothing should happen in-game (unless something is bound to TAB).
Actual behavior is that the window loses focus and the cursor becomes detached from the window.
The root cause is that the console textbox is being focused by OpenFL even when the debugger is not open.
Tested and with this fix the textbox still focuses when the debugger is OPEN (as expected).