Why can’t you use the Tab key to select items from the auto-complete drop-down?

An anonymous commenter asked why the Tab key doesn't select items from the auto-complete drop-down list. The answer: Because that key already has some other meaning.

The Tab key is used to navigate among controls in a dialog box. Adding auto-complete behavior to an existing dialog would disturb the tab order, which would in turn frustrate people who had "muscle-memorized" their way through the system. Instead of, "Ctrl+O text Tab Space Enter", it's "Ctrl+O text ... um... try to get the auto-complete drop-down to go away so the Tab key will take you to the next radio button, then hit Tab, Space, Enter."

If the auto-complete drop-down list were attached to a control in a dialog box, say, the edit box in the Start menu's "Run" dialog, then it wouldn't be possible to tab from the edit box to the Browse button or the OK button. Even worse, notice that the drop-down box covered the OK, Cancel and Browse buttons, so you can't use the mouse to click on them. And since you can't see them, you can't see what their accelerator key is.

That said, if you really want the Tab key to select items from the auto-complete drop-down, you can pass the SHACF_USETAB flag to the SHAutoComplete function. It appears that Internet Explorer's Open dialog passes this flag, because the scenario I described above actually happens when you want to open a web page as a Web Folder. You type Ctrl+O to open the Open dialog, type the URL, and then grf urgh can't get to the "Open as Web Folder" check-box...

As for the problem of not remembering its original size: The naive solution can cause more problems than it fixes. Suppose you preserve the size of the drop-down box on Internet Explorer's Address bar. Now the user resizes the window. Does the drop-down box keep its original size? Or does it resize by some mysterious algorithm to "match" the new size of the Address bar? What if the user runs the program after changing the screen resolution to 640×480 and the drop-down becomes bigger than the screen? If you keep the saved size, the resize gripper will end up off the edge of the screen. What if there are two Internet Explorer windows on the screen; should resizing one Address bar drop-down result in the other one changing to match? I'm not asking for answers to these questions. I'm just pointing out that in many cases, coding up a "fix" is the easy step. Designing the fix is the hard step. And then testing the fix with real users may force you to go back and reconsider your original design. Eventually, you spent three weeks fine-tuning this tiny feature. Could that time have been better-spent on some other feature that has greater impact? (Not to mention all the Slashdotters who would say, "Everybody who is working on these tiny features should be punished and told to work on security instead!")

Comments (17)
  1. J says:

    Nah, I think they’d make a jab that everyone in the company should be working on Vista instead.

  2. Carlin says:

    I think the real question should be is why do drop down lists only work off of the first character of the word (and not like windows explorer does)?

  3. Rick C says:

    J:  why?  It was RTMed.  Now ifyou want to modify that to "working on Vista SP1 instead" … :)

  4. Nick says:

    >Not to mention all the Slashdotters who would say,

    omg kde had that feature 20 years ago stupid ms copycats

  5. Marquis says:

    Enabling inline autocomplete obviates the need for tab (or the up/down arrows) in these text boxes system-wide. Of course, most users probably have never seen this option, given that it is illogically tucked away under Control Panel|Internet Options|Advanced|Browsing.

    It is a good things to keep behavior consistent, across all controls.

    It would be nice if enter were equally consistent. It always OKs a dialog box, except–frustratingly–for multi-line edit controls and some buttons.

  6. Spire says:

    Marquis: Inline AutoComplete is an inherently dangerous feature. There’s a reason it’s disabled by default.

    See: http://blogs.msdn.com/oldnewthing/archive/2005/11/02/488163.aspx

  7. 4-80-sicks says:

    Who asks this question?  Is it too hard to press down-arrow when the field in question has the focus?

  8. Good Point says:

    On the subject of the "Run" dialog…

    When you hit Alt+Down Arrow to display the MRU list, arrow to select the item you want, Enter will close this list.

    If on the other hand you start typing and the auto complete list shows up, you press down arrow to select the item you want, Enter doesn’t close the list.  It dismisses the dialog!

  9. Stu says:

    Easy solution:

    Tab autocompletes, then hides the drop-down

    Esc hides the drop-down.

    Keys act normal when drop-down is hidden.

    [Therefore, to dismiss the dialog box you have to look at the screen to see whether you need to hit Escape once or twice. Maybe this doesn’t bother you, but you should state that up front. -Raymond]
  10. Mark Steward says:

    "Good Point" – of course, this was always a combo box, so the behaviour of Enter should be preserved (IMHO, Enter shouldn’t be caught by combo boxes).  This brings up an exception to the "muscle memorising" rule – that the Escape key’s behaviour is changed.  But you’re usually looking at the screen then anyway…

  11. Andrew says:

    The most annoying behaviour for auto-complete is when your mouse cursor is above the selection list.

    Then doing up or down with arrow keys won’t work, because the mouse will always make it select what’s underneath the cursor.

  12. >omg kde had that feature 20 years ago stupid ms copycats

    Not in the KHTML viewer.

  13. Mike says:

    I can definitely see why you wouldn’t want Tab to move through items in an auto-complete or other drop-down list, but I’ve been frustrated when navigating forms via the keyboard by the fact that, once I get my auto-complete or drop-down item selected, hitting the Tab key goes to the next item in the Tab order and cancels my selection.  You have to hit Enter, then Tab to select and move on, whereas it’s always seemed logical to me that Tab would move on and preserve the item I have highlighted as the selection.  Does that make any sense?

  14. Dan McCarty says:

    I think the Run dialog does the right thing.  In normal mode, it pops up the combo box that handles tab as a tab to the next control.

    In auto-complete mode (after you start typing), it handles a tab the same way the command line handles a tab (CompletionChar).  The only frustration I have with entering paths in the Run dialog is that if I start typing


    the auto-complete feature highlights "ments and Settings" but doesn’t give me an easy way to complete the path.  That would be handy.

    WRT the remember of its size, the scenarios that you listed can all be solved by "return to default size."  Otherwise, it should save its size.  I find myself constantly expanding the window to see its contents, only to have to do it again the next time.

    Sanchez: by "dangerous," I do not think it means what you think it means.  Surprising, maybe?

  15. anonymoose says:

    Uh, you *can* use TAB to select items from the AutoComplete dropdown…if you enable the setting using Tweak UI (XP): Explorer->Settings->Use TAB to Navigate AutoComplete.

  16. Igor says:

    Who in the world wanted TAB for that? I’d kill him if I knew… oh wait, I don’t have any weapons. Never mind, I would scream their head off with a resounding NO WAY.

  17. Good Point says:

    Therefore, to dismiss the dialog box you have to look at the screen to see whether you need to hit Escape once or twice. Maybe this doesn’t bother you, but you should state that up front. -Raymond

    Maybe I’m missing your point, but isn’t this the way it currently behaves???

    Bring up the Run dialog, start typing something.  If the auto complete list shows up Escape won’t close the dialog, it’ll close the auto complete list.  So, you do have to look at the screen to see whether you need to hit Escape once or twice.

    [Well how about that. It was probably designed that way, but I consider it a design flaw. -Raymond]

Comments are closed.

Skip to main content