JSFiddle - React, Tailwind, and code Playground

HTML

<body>
  <form>
      <input type="file" id="fileElem" multiple accept="image/*" style="" onchange="handleFiles(this.files)" />
  </form>
  <a href="javascript:popRightAway()">Pop Now</a>
    <br />
  <a href="javascript:popWithDelay()">Pop With 1 Second Delay</a>
    <div id="log">Log: <br /></div>
</body>

JavaScript

popFileSelector = function() {
    var el = document.getElementById("fileElem");
    if (el) {
        el.click();  
    }
};

window.popWithDelay = function() {
    document.getElementById('log').innerHTML += 'I am gonna delay!<br />';
    window.setTimeout(function() {
        document.getElementById('log').innerHTML += 'I was delayed!<br />';
        popFileSelector();
    }, 1000);
};

window.popRightAway = function() {
    document.getElementById('log').innerHTML += 'I am right awar!<br />';
    popFileSelector();
};