I'm having a problem where I want to have an input box above a select box (multi). The select box has more items in it than the height of the box. (I am setting the size of the box lower than the number of items).
<select id="multiSelect" size="3" multiple>
<option value="item1">Item 1</option>
<option value="item2">Item 2</option>
<option value="item3">Item 3</option>
<option value="item4">Item 4</option>
<option value="item5">Item 5</option>
<option value="item6">Item 6</option>
</select>
I want to allow the user to enter values in the above text input, then use their "down arrow" to move to the results that would appear in the select box.
inputField.addEventListener("keydown", function(e) {
if (e.keyCode == 40) {
multiSelect.focus();
multiSelect.selectedIndex = 0;
}
});
When the user does this, the first item in the multi select box gets scrolled out of view. This problem happens in both Chrome and Firefox (on a Mac [Safari is fine]).
You can see the problem here.