TextBox.FocusLost not firing on Consoles

Hi!

Currently, with the addition of chat on consoles, our console players are experiencing issues sending messages in our game Emergency Hamburg, which uses a custom chat system.

After some testing, we noticed that the FocusLost Event, which we use for sending messages (and in other places), does not fire on consoles, which makes console players currently unable to send messages in our game. I would of course expect FocusLost to fire on consoles as well, as it’s the same thing as on pc and mobile.

Reproduction Place: Console FocusLost Bug Report - Roblox
When unfocusing the TextBox in the reproduction place on mobile or PC, players can see a notification in the bottom right corner that includes the info if enter has been pressed. This does not happen on consoles.

I am aware that there is a ReturnPressedFromOnScreenKeyboard, but for some usages we have of FocusLost (e.g. autosaving some input text), this doesn’t work because it requires return to be pressed which is something we do not need there. Also, the behavior is simply inconsistent because FocusLost is fired on mobile even though ReturnPressedFromOnScreenKeyboard is also fired, which would require some kind of debounce system.

Thanks!
~ Felix

Hi Felix,

Are you able to connect to ReturnPressedFromOnScreenKeyboard and then manually call textbox:ReleaseFocus()? You can then override enterPressed based on what you need.

I’m not sure why we don’t automatically release focus on the textbox on Console, but maybe that’s just the default behavior. I can look into it more if you want.

Thanks,
Ro_JJam

Hi Ro_JJam!

Great idea! For the scenarios where we check if enterPressed is true, this could work as it solves the issue with both events being called. I’ll test it and let you know if it works.

In the cases where we don’t check if enter is pressed (like just auto-saving configuration settings for users, we don’t care if enter was pressed or not, we want to know if the user finished editing the text), I think this won’t work because ReturnPressedFromOnScreenKeyboard is only called if enter was pressed.

I think it would be worth looking into, as many Devs rely on FocusLost behavior even without enter being pressed. If that’s intentional, then there probably should be some ReturnPressedFromOnScreenKeyboard, but without requiring return to be pressed.

For consoles, I think ReturnPressedFromOnScreenKeyboard should be called if the user exits the on-screen keyboard via confirmation instead of cancelling and they shouldn’t need to actually press Enter. Could you let me know if this is or isn’t the case?

Hey,

  1. We did test your idea with manually calling textbox:ReleaseFocus(). It kinda works, but not immediatly, the user has to submit the text twice before it works, as you can see in the video:

So the workaround doesnt really work unfortunatly.

  1. So my colleague says only enter works, however what i mean is not just any confirmation, i also want to be informed if the user does not confirm the input - as the text is still in the affected textbox, and i would like to know when they finished entering text.

Could you share the code you used to trigger textbox:ReleaseFocus()? And can you also explain point (2) a bit more? I thought that when a user does not confirm the input on consoles, the text automatically disappears

Here is a test place I made that sends messages without issues. You can copy/edit it in Studio to see the implementation. It’s probably not following the best practices, but can you let me know how this differs from your use case?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.