- Loading...
Author: Dusan Pavlica
This document is the user experience specification for the JavaFX ComboBox control.
A ComboBox is a control that contains info part on the left side and drop down arrow on the right side. User can click the arrow to invoke the list of choices. If the list is too long then scrollbar appears. Currently selected item appears next to the drop down arrow and it can be editable or non editable.
A "Drop Down List" UI control or "Non-editable Combo Box" terms are used instead of a Combo Box sometimes, so let's take a look at the following examples of Drop Down list/Combo Box UI control to get a general idea what types exist on web, TV and desktop platform:
Figure 1: Combo Box in Swing. There is non editable Combo Box/ Drop Down list on the left hand side.
Figure 2: JavaFX Drop Down List experimental implementation (Author calls it Combo Box)
Figure 3: Editable Combo Box on Windows 7 platform
A combo box is a combination of a list box and a single-line textbox, allowing the user to either type a value directly into the control or choose from the list of existing options. Also it allows user to add a new value if it doesn't exist in the list.
The term "combo box" is sometimes, incorrectly, used to mean "drop-down list". This distinction between "combo box" and "drop down list" is clarified with terms such as "non-editable combo box" (or something similar). Combo boxes are often applied to provide autocomplete or autotype functionality in a convenient way to the user. Let's look at the following basic UI elements of combo box:
Figure 4: Basic look of Editable Combo Box
There is editable text box area on the top left hand side and drop-down button placed next to it. If user clicks the button the drop-down list is invoked. User can choose an item from the list and it will be populated in the text field area. Or he can add a value into textfield manually.
Combo Box - Combo Box can exist in the following different states:
Normal state | ||
Focused state | User can get to the Focused state by Tab Traversal or by clicking the textfield area. Then there is a focus indication around the Combo box Also a key cursor is displayed because the Combo box switches into Edit state right after it gets focus. | |
Disabled state | User can't edit the text or expand dropdown list if the Combo Box is disabled. The Combo Box isn't focusable in that state and user can't use it. | |
Expanded state | Drop-down list appears when user clicks the button. Also there is selection and hover indications visible in the drop down list. User confirms a selection in the dropdown list by mouse click or by dragging from the drop-down arrow to the selection and releasing the mouse button. | |
Hover (Mouse Over) state | This visual indication appears when user points his mouse cursor above the drop down button in the Combo Box. | |
Pressed/Armed state | User clicks the drop down button. | |
Edit state - different position of the cursor | User can edit value in the Combo Box. User confirms the edited value by pressing Enter key. | |
Edit state - the whole value is selected | User can select the whole text in the textfield by pressing Ctrl+A or by double click. |
The following table describes actions that are performed when users click on:
Button | Action |
---|---|
Drop Down icon | Display/Hide the active list. Item that is displayed in the textfield is selected when the active list is open. |
TextField | [Non-editable Combo box] Display/Hide the active list. Item that is displayed in the textfield is selected when the active list is open. [Editable Combo box] Place the I-beam cursor into the textfield. |
Item in the list | Close the active list and commit the value. |
Outside the list | [Active list is open] Close the active list. |
The following table describes actions that are performed when users tap on:
Button | Action |
---|---|
Drop Down icon | Display/Hide the active list. Item that is displayed in the textfield is selected when the active list is open. |
TextField | [Non-editable Combo box] Display/Hide the active list. Item that is displayed in the textfield is selected when the active list is open. [Editable Combo box] Place the I-beam cursor into the textfield. |
Item in the list | Close the active list and commit the value. |
Outside the list | [Active list is open] Close the active list. |
The following table describes actions that are performed when users navigate to the Combo box using the arrow keys and press:
Keystroke | Action |
---|---|
OK/SELECT on Drop Down icon | Display the active list. Item that is displayed in the textfield is selected when the active list is open. |
OK/SELECT on TextField | [Non-editable Combo box] Display the active list. Item that is displayed in the textfield is selected when the active list is open. [Editable Combo box] Place the I-beam cursor into the textfield. |
OK/SELECT on an item in the list | Close the active list and commit the value. |
UP/DOWN keys | [Active list is open] Move the selection up/down one item. |
LEFT/RIGHT keys | [Editable Combo box] Move the I-beam cursor left/right one character within the textfield. If the I-beam cursor is right behind the last character in the textfield, select Drop Down icon (assumption: Drop Down icon is placed on the right/left side of the textfield). |
Please note that Editable Combo box is not supported on platforms with lack of keyboard.
The following table describes how keystrokes should be processed in case Combo box has focus on Win and Mac platforms:
Keystroke | Action |
---|---|
F4 | Open/Close the active list. Item that is displayed in the field is selected when the active list is open. |
ALT-UP/DOWN | Open/Close the active list. Item that is displayed in the field is selected when the active list is open. |
UP/DOWN | [Active list is open] Move the selection one item up/down and update the value in the field. [Non-editable Combo box] When a ComboBox is focused, pressing up/down keys changes items in the field. |
ENTER/SPACE/ESC | [Active list is open] Close the active list. |
Any Key | Move the selection to the item matching prefix letters. |