I've been coding a simple logic game recently and there is a UI decision that has been bothering me.

Since certain blocks of logic are going to be used across many levels (e.g. logic to reverse the input queue) I decided to add a template feature, allowing the user to name and save blocks of logic.

As it stands, I simply have a text field in which to enter the template name. While the game is primarily played with the mouse, some keys are used as controls (w, a, s, d, space, delete). This creates the requirement of deciding when to take focus away from the text field. Some decisions are obvious (e.g. when the user presses the New Template button and the template is created) but others, not so much. For example, the user clicks the text field, then decides not to create a template.

While one option is to simply pop up a dialog and remove the text field from the main UI altogether, I was trying to avoid this. Does anyone have any thoughts on what would be a good trigger for taking focus away from the text field? Or do you think I should just drop the field and go with the dialog?

Main UI

  • \$\begingroup\$ This might go better in User Experience. \$\endgroup\$
    – user15805
    Jan 7, 2013 at 13:35

1 Answer 1


I find it's typically best to go with what people expect.

In this situation I think the typical user would expect the text field to activate when clicked, take any keyboard input given (including the controls you use in game), then loose focus when the user clicked somewhere else or pressed enter to submit the changes.

If the user wanted to cancel the action, they could hit ESC or you can present a cancel button when the text field is active.

  • 2
    \$\begingroup\$ Agreed. When in doubt, mimic the default behaviour of the host OS. \$\endgroup\$ Jan 7, 2013 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .