title: JS scrollIntoView not working with focus()
body: <p>In a single function, I'm trying to achieve 2 things :</p>
  <ol>
  <li>Scroll to a section</li>
  <li>Focus on an input</li>
  </ol>
  <p>This is my code :</p>
  <pre><code>function search() {
    document.getElementById(&quot;searchbar&quot;).style.display = &quot;block&quot;;
    document.getElementById(&quot;flex&quot;).style.display = &quot;none&quot;;
    document.getElementById(&quot;books&quot;).scrollIntoView({behavior: 'smooth'});
    key();
  };
  function key(){
    document.getElementById(&quot;searchbox&quot;).focus();
  };
  </code></pre>
  <p>The scrolling is not working here. If i remove the 'key' function, it works.</p>
  <p>There's no need for separate 'key' function, but i tried.</p>
  <p>The input with id &quot;searchbox&quot; is placed inside a &quot;position:fixed&quot; division. Its outside the &quot;books&quot; section.</p>