<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p>
Test that selection box scrolls to where the focus jumps when pressing an alphanumeric key.
</p>
<selectlist id="selectlist">
<listbox>
<div style="max-height:10vh;overflow:auto" id="selectlist-listbox-scroll">
<option>aardvark</option>
<option>blue</option>
<option>navy</option>
<option>indigo</option>
<option>azure</option>
</div>
</listbox>
</selectlist>
<div id="result">Cannot run interactively.</div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
var selectlist = document.getElementById("selectlist");
var listboxScroll = document.getElementById("selectlist-listbox-scroll");
selectlist.focus();
eventSender.keyDown(" ");
shouldBeTrue('selectlist.open');
eventSender.keyDown("a");
eventSender.keyDown("z");
setTimeout(function() {
var result = document.getElementById("result");
result.innerText = listboxScroll.scrollTop > 0 ? "SUCCESS" : "FAIL";
testRunner.notifyDone();
}, 1000);
}
</script>