JSFiddle - React, Tailwind, and code Playground

HTML

<select>
    <option>Hello world</option>
    <option>Foo</option>
    <option>Bar</option>
    <option>StackOverflow</option>
</select>

JavaScript

HTMLSelectElement.prototype.closeDropdown = function () {
    var parent = this.parentElement;
    var anchor = document.createElement("div");
    parent.insertBefore(anchor, this);
    parent.removeChild(this);
    parent.insertBefore(this, anchor);
    parent.removeChild(anchor);
}

var select = document.querySelector("select")
select.onclick = function () {
    select.closeDropdown();
}