algolia / algoliasearch-netlify

Official Algolia Plugin for Netlify. Index your website to Algolia when deploying your project to Netlify with the Algolia Crawler
https://www.algolia.com/doc/tools/crawler/netlify-plugin/quick-start/
261 stars 10 forks source link

Feature request: adding autofocus option to Netlify frontend bundle #849

Open tinyapps opened 1 year ago

tinyapps commented 1 year ago

If time and resources permit, please consider adding the autofocus option to Netlify's frontend bundle. At the moment, this is what I'm doing instead (improvements by JavaScript wizards welcome!):

<script>
      // Wait 250ms before setting focus on the input element
      setTimeout(function() {
      // Get the input element
      const input = document.querySelector('input');
      // Focus on the input element
      input.focus();
      }, 250);
</script>