JSFiddle - React, Tailwind, and code Playground
HTML
<select id="foo" size="5">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option selected="true">6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
</select>
JavaScript
var sel = document.getElementById("foo");
var optsLen = sel.options.length;
var selIndex = sel.selectedIndex;
var size = sel.size;
if (selIndex>=size) {
var newIndex = selIndex+size+1;
if (newIndex>optsLen) {
newIndex = optsLen;
}
sel.selectedIndex = newIndex;
setTimeout(function(){sel.selectedIndex = selIndex},1);
}