JSFiddle - React, Tailwind, and code Playground
HTML
<select multiple size="1" onfocus="show_more()" onblur="show_less()" id="my_select">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
JavaScript
function show_more()
{
document.getElementById('my_select').size = 3;
}
function show_less()
{
document.getElementById('my_select').size = 1;
}