If you clear the box, you're taking away control from the user. While you may seem like you're doing them a favor, you're robbing them of context for what they just typed in.
When you type things into a command prompt, the previous command you typed is still there.
Although you state that it's a long ID that the user probably just pasted in have you thought about how the user will compare.
For example, if your user is entering a GUID like this:
21EC2020-3AEA-4069-A2DD-08002B30309D
What if your user copied it like so: 21EC2020-3AEA-4069-A2DD-08002B30309
? If you clear the search box after they type it in, and your user doesn't find the entry they are looking for, what's the first thing that they'll do? They'll either re-copy, re-paste, or COMPARE what they pasted with the original. In this case, they may notice that they mis-copied and didn't select the D
at the end.
Compare using a standard single-display calculator with one that has multiple display lines. Which do you think has the superior UX?
To answer your question as to whether it's expected, there is a long history of keeping input around for review. Old calculators with a tape were designed for this reason. Accounting ledgers. YouTube 'history'. Command prompts in a terminal window. Temperature displays. Even volume controls on your car. When you change the volume, the volume level usually stays in the display for a few moments, even though the number has little meaning.
You may feel that a long obscure ID has little relevance to the user, but you can never know how the user is going to use that in their workflow. Maybe they use the ID to compare, correct mistakes, copy it out of the search window into a different browser.
I do have one suggestion that would seem especially appropriate given your users are entering IDs
and CODEs
in a search dialog. When they user clicks on the input
select the whole entry for them, so they can either paste over the entry or start typing. I think you're right in that most CASES, users will rarely modify or add to the ID they entered ( apart from correcting mistakes ) so it's pretty important that you make it easy for the user to start a new search anew.