3

What should happen if a user is scrolling through items in a combobox with the keyboard and they press the Tab key? Should it behave like the Enter key, selecting the currently highlighted item and stepping to the next control? (I've seen this on webpages such as google applications) or should it behave like pressing escape to close the control and then jumping to the next control? (I've seen this in the built-in look and feel for on Java for the mac.) I'm biased myself because I often lose a selection I'm making when I hit tab by habit, but I can't find any accessibility guidelines that support using it to commit the value. I'll also note, it's a pain to implement in Java swing and seems to require an ugly hack.

If the answer depends on the platform where the application is running, then it may be a complicated answer. I'm working on a cross-platform desktop Java application (majority Mac, with substantial windows and linux populations) that we expect to eventually migrate to the web.

2

First off, for accessibility reasons it is really important that the Tab key instantly goes to the next item in a form (based on a Tab order that makes sense -- Left to Right, Top to Bottom) I know this isn't your question but I wanted to make sure people didn't suggest preventing the TAB key from registering or any such non-sense.

If a combo box has focus and I type the letter 'T' and see 'Texas' highlighted then I should be able to hit ENTER or TAB at this point and get the same result.

I don't think you are going to find anything official on this but I can find bug reports when this isn't the case.

  • LOL! ...preventing the TAB key from registering... is exactly what I suggested, based on the "no action is better than an irrevocable wrong action" theory. I'm assuming your accessibility reasoning rests on the possibility that access-challenged individuals might not have easy access to both the tab and enter key; possibly a foot-petal mapped to the tab key. That makes sense and might trump my concern for lost data. I'm still a little concerned that with an open combobox might inappropriately change values when all that was desired was to tab on through. – Henry Taylor Dec 10 '14 at 22:18
  • 1
    I guess our answers got crossed in the wires but yes accessibility trumps everything else here. Tab order is a very well established pattern that has made its way into hardware and software on every platform. It's unfortunate that the most user friendly behavior didn't make it into Java (according to Joshua Goldberg) – DaveAlger Dec 10 '14 at 22:27
1

Design by the principle of least surprise.

The user pressed the tab key 99.999% of the time this was not an error. So what do they expect?

Consistency heuristic would guide that users expect same behaviour as their most familiar platform - if they actually know the behaviour in that platform. For something this subtle that would be the minority.

User would be surprised by

  • Data being lost (i.e. lose the current selection input)
  • Nothing to happen (why would press key?)

Action is not "irreversible" so no harm in doing the "least surprising thing possible". Namely accept current value and move to next control.

0

You've listed two possible behaviors: mimicking an enter key or mimicking an escape key. Have you considered doing nothing at all? Just discard the keystroke as inappropriate for the particular control (combobox) in its current state (option-list-showing).

As long as your combobox doesn't automatically show its option list when it gets the focus, then you might be fine just ignoring the tab-key and waiting for the user to catch on that a different keystroke is needed.

If your combobox does open automatically on focus, you probably shouldn't discard the tab because it might indicate that the user is trying to navigate past the combobox to the next control.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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