Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

On input focus, I ask the developer to automatically select any previously entered text. Doing so, it will allows users to enter a new search by typing, or to modify the previous search. Is this usable? Is this a best practice?

enter image description here

share|improve this question
    
I've definitely seen this used before. It can be a bit jarring at first but can also really increase efficiency depending on how often you use it (and how often you don't want to totally replace the search term). –  Ben Brocka Aug 10 '12 at 18:12
    
You're right, I will Danny. English is not my primary language, so I need time to translate my answer. :) –  Benoit Meunier Aug 14 '12 at 15:29
add comment

2 Answers

I used to try to achieve the same thing in Java Swing. Just select everything when the textfield receives the focus. However, doing so may actually introduce more issues than leaving the selection away if not carried out properly. If you opt of the selection upon focus gain, at least the following points should be checked:

  • The focus can enter the searchfield in different ways: TAB, direct click, initial focus in popup dialog, etc. Do you really want to select everything in all cases? Maybe it makes sense only if using the keyboard, depending on your application/users. As an implementation, it may be hard to determine why the searchfield gets the focus. For example in Swing, listening on the focus grab events would make your searchfield select everything if the parent window regains the focus after loosing it. For example, if you click the searchfield, remove the selection, give the focus on another window, then give the focus on the searchfield window, then everything will get selected again. It is maybe a minor issue for a searchfield, but might be more of an issue is some other cases.

  • Many (I mean MANY) users often try to select the searchfield text (part of it or entirely) using click+drag. I could see so many people using it that way. In this case, you wouldn't want to select everything automatically upon focus gain. Also, if the user does a click+drag, the location of the cursor | should be at the end of the drag manipulation. For example, if the user drags from right to left (most likely if the text is left-aligned), the cursor should remain on the left. But you select the text automatically just upon focus gain, chances are that the cursor will always be on the right.

  • If the user just clicks in the middle of the text: then you would either put the cursor exactly at the position of the click (thus no selection of text), or select everything.

  • As a complement to this, if the user just clicks on the empty space after the text (or before the text if right-aligned): then you would either select everything (a bit like if you click on the side of the document in Word: the whole line gets selected) or just put the cursor at the end of the text (respectively at the beginning if right-aligned).

  • If a first single click results in selecting everything, then another single click would clear the selection and put the cursor | at the exact location of the mouse pointer.

A good working example IMHO is the omnibar in Google Chrome on Windows. Note that the behavior is different on Linux...

share|improve this answer
add comment

There are two possible scenarios here.

  1. We assume that by default the user wants to replace the search term. In this case the selection aids him, and in case he wants to refine rather than replace the term, all he needs to to is hit "end" or "home" or any of the arrow keys, and the selection is canceled.

  2. We assume that by default the user wants to refine the search term. Then it's best not to select the existing term. But if he wants to replace it, then he needs to either hold "delete" or "backspace" (depending on where you place the cursor) or do shift+home/end.

If you have a good idea of who your users are and what they are likely to do, this should help you decide. Also, I'd say that unsophisticated users are less likely to realize what the selection means (i.e. that anything they type will replace the entire text), and they're also less likely to know the shift+home/end combo.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.